Open Veryyapeee opened 4 months ago
Hey!
There is a method, it's just called focus
but not scrollTo
😁
https://github.com/bamlab/react-tv-space-navigation/blob/main/docs/api.md#spatialnavigationvirtualizedlist
Using a little useEffect you should be able to add your default focus 😁
I'm closing, feel free to tell me if it's not enough!
Hey! There is a method, it's just called
focus
but notscrollTo
😁 https://github.com/bamlab/react-tv-space-navigation/blob/main/docs/api.md#spatialnavigationvirtualizedlistUsing a little useEffect you should be able to add your default focus 😁
I'm closing, feel free to tell me if it's not enough!
It's kinda okay, but the issue is that calling focus works with animation, and if I have like 2 lists, and I want to set default index to for example 3, entering screen is ugly, lists are moving, adding possibility to disable animation while imperatively focusing target element, would be awesome
Makes sense! Let's reopen :wink: Thanks!
I was discussing this feature with the others. We were wondering: why would you need a default position that is not the position 0? What is the use case?
We think that it's a little weird, because this might hide content from the user if the list is not at the beginning, right?
I was discussing this feature with the others. We were wondering: why would you need a default position that is not the position 0? What is the use case?
We think that it's a little weird, because this might hide content from the user if the list is not at the beginning, right?
Actually this is a very common practice among any kind of OTT applications, like:
Banner -> showing "netflix" like banner with pagination dots, a lot of companies likes to set default item to idx=1 EPG list (program schedule for tv content) - most of the times we want to show first item as the item which is currently playing, but allow user to go back in the list to browse "catch up" content
There are a lot of use cases
OK, thank you for the very quick answer 🙌 I confirm that we add it to our backlog 👍
OK, thank you for the very quick answer 🙌 I confirm that we add it to our backlog 👍
Also I've noticed a problem when I've tried to implement workaround using .focus method on list ref
When I have multiple lists that come from external API, and I call .focus on each of them (each of them have different initial position), there is a problem, in which I press any button, and focus is redirected automatically to last list, which is also not ideal
Is your feature request related to a problem? Please describe. Currently there is no way to set default/initial focus index on virtualized list There is no even any ScrollTo method exposed
Describe the solution you'd like Add prop for initial index, or expose anything like ScrollTo method
Describe alternatives you've considered Wrapping stuff in