You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
The component should be able to receive focus when isFocusable is set to true and should not receive focus when it is false.
Screenshots
If applicable, add screenshots to help explain your problem.
Version and OS
Library version:4.0.1
React Native version: react-native-web 0.19.13
OS: web
Additional context
I found that adding isFocused as a dependency at this line resolves the issue. However, I'm uncertain if this is an appropriate solution.
The text was updated successfully, but these errors were encountered:
Good catch, I hadn't thought of this. It's very unexpected indeed.
The patch is dangerous and will break things if you have nested nodes. It works if you don't 😁 But I would strongly not recommend it. Why? Because it unregisters / re-registers the node when isFocusable will change. Un-registering the node will also un-register the children, but we have no way to know this on the children side, so we will just kill all the children nodes.
This piece of code is about adapting the LRUD lib - the core underneath the spatial navigation - to React, and unfortunately this part is not very flexible (hence the non standard useEffect where we ignored some dependencies).
This needs a bit of manual testing but that should be OK 😁
// in Node.tsxuseEffect(()=>{spatialNavigator.setIsFocusable(id,isFocusable);},[spatialNavigator,isFocusable])// in SpatialNavigator.tspublicsetIsFocusable(nodeId: string,isFocusable: boolean){this.lrud.setIsFocusable(nodeId,isFocusable);}
Describe the bug
The SpatialNavigationNode component does not function correctly when the isFocusable prop is changed dynamically.
To Reproduce
Expected behavior
The component should be able to receive focus when isFocusable is set to true and should not receive focus when it is false.
Screenshots
If applicable, add screenshots to help explain your problem.
Version and OS
Additional context
I found that adding isFocused as a dependency at this line resolves the issue. However, I'm uncertain if this is an appropriate solution.
The text was updated successfully, but these errors were encountered: