react-focus-lock icon indicating copy to clipboard operation
react-focus-lock copied to clipboard

FocusLock children prop

Open nklhtv opened this issue 6 years ago • 3 comments
trafficstars

Does children prop of FocusLock required to be a single node or even a single dom node? Does the as prop expected to forward a ref to a dom node? I want to use the FocusLock like that:

const MyComponent = React.forwardRef((props, ref) => {
    return <div ref={ref} {...props} />
});
...
<FocusLock as={MyComponent} className={'class-name'} lockPorps={{...}} />
...

nklhtv avatar Oct 05 '19 10:10 nklhtv

Does the as prop expected to forward a ref to a dom node?

To some dom node around content, yes. No matter which one.

Does children prop of FocusLock required...

It's required to be "anything renderable as children", which is usually just node.

theKashey avatar Oct 06 '19 01:10 theKashey

i cant find the case where you need children. that propType should not be required, because of the use case i described above.

nklhtv avatar Oct 06 '19 05:10 nklhtv

From #87

  • [ ] move Sidecar out of Container
  • [ ] remove restrictions from PropTypes
  • [ ] for TS - infer the right children type

theKashey avatar Oct 08 '19 06:10 theKashey

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.

stale[bot] avatar Apr 30 '23 12:04 stale[bot]