Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled prop no longer passed to WrappedComponent #190

Closed
davidgoli opened this issue Apr 19, 2017 · 1 comment
Closed

Disabled prop no longer passed to WrappedComponent #190

davidgoli opened this issue Apr 19, 2017 · 1 comment

Comments

@davidgoli
Copy link

Our implementation of a sortable list ca. 0.0.9 depended on the disabled prop being passed through to the wrapped child component, but it appears as of 0.6.2 this is no longer the case. Our workaround currently looks like this:

const Item = SortableElement(({ child, itemClassName, disableSorting }) => {
  const classes = classnames('sortable-item', { 'sortable-item--disabled': disableSorting }, itemClassName)
  return <RecordListItem className={classes}>{child}</RecordListItem>
})

const List = SortableContainer(({ items, loaded, copy, itemClassName, disableSorting }) => {
  const renderChild = (child, index) => {
    const props = {
      key: `item-${index}`,
      itemClassName,
      index,
      child,
      disabled: disableSorting,
      disableSorting,
    }
    return <Item {...props} />
  }

  return (
    <RecordList loaded={loaded} copy={copy}>
      {items.map(renderChild)}
    </RecordList>
  )
})

Would be great to just use the disabled prop and not have a duplicate prop for this. Is there any reason why disabled is explicitly omitted from the passed-through props?

@clauderic
Copy link
Owner

Yeah, this is an unfortunate side-effect of #98

See #128 and #180 for more context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants