This repository has been archived by the owner on May 5, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: this is not quite ready to merge but wanted to open this pull request as a start to figure out how this can be accomplished. We use this library at work and it would be cool to have a nice hooks implementation.
useFocusable
An initial implementation of
useFocusable
a hooks based version of thewithFocusable
HOC. This is current working using a ref callback to get the DOM node. It also requires the user to provide the parentFocusKey manually.First Note
Because this is using a ref callback instead of
findDomNode
when used with react native components such asView
the ref isn't going to point at a DOM node even if you are running it in the browser. I'm not familiar with how this library works with React native as it doesn't seem you can ever find the position of a native element when innativeMode
?Second Note
It would be nice to come up with a solution to not have to pass in parentKey manually. This comes with some challenges when using hooks. I made a suggestion in this issue thread that would be worth putting a bit of brain power to to figure out if there is a solution.