bamlab / react-tv-space-navigation

A React Native module to handle spatial navigation for a TV application in a 100% cross-platform way
https://bamlab.github.io/react-tv-space-navigation/
MIT License
199 stars 17 forks source link

Add possibility to disable ScrollView #141

Open Veryyapeee opened 1 month ago

Veryyapeee commented 1 month ago

Is your feature request related to a problem? Please describe. Disabling focus in ScrollView based on flag

Describe the solution you'd like Easy ability to disable scroll for ScrollView

Additional context I'm working on component, and I want to hide component with opacity (to keep last focused element), and I'm showing the component on arrow press The issue is, that in this case the scroll view still scrolls, and I would like to disable scroll for that component Native scrollView have a prop to disable scroll, but it seems like your library doesn't propagate any props which could solve the issue

Or it would be cool if we could lock the focus in scope of component, so for example some kind of prop to FocusableView/Node which would lock focus in every children, this would help a lot

pierpo commented 1 month ago

Hey! I'm not sure I understand your need properly. Why would you hide a focusable component? That means your focus will be lost at some point, right? Since you'll be focusing a hidden element.

Could you do a drawing of what you are achieving?

Besides, I'm not sure locking with disableScroll will work as we do imperative scrolling under the hood. We'll have to try 😁

Veryyapeee commented 1 month ago

Hey! I'm not sure I understand your need properly. Why would you hide a focusable component? That means your focus will be lost at some point, right? Since you'll be focusing a hidden element.

Could you do a drawing of what you are achieving?

Besides, I'm not sure locking with disableScroll will work as we do imperative scrolling under the hood. We'll have to try 😁

Hi, so I'm developing kinda complicated flow, where I have multiple layers, and it works like that

I'm displaying the layer -> pressing back -> closing layer And when no layer is active, based on arrow key pressed, different layer is presented So when I have layer "A" open, then I press back, and then for example arrow right (which again opens layer "A") I want to open layer A again, with focus in the same place SInce unmounting component is causing focus to get lost (obviously), I'm hiding the layer with plain opacity, but the issue is, that when I press the "arrow right" I just want the layer to show (so disable scroll for that period of time), instead, pressing right scrolls the list, because obviously it's focused and just hidden by opacity