flexn-io / create

Build apps for web, TVs, desktops, consoles, wearables and more. Developer friendly UI library targeting all form factors platforms. Another notable feature is providing focus management for TVs which very easy to implement using Create.
https://create.flexn.org
MIT License
26 stars 6 forks source link

Set focus on long flashlist #190

Open saimirg opened 7 months ago

saimirg commented 7 months ago

Hi, I have along carouse/flashlist and i want to set the focus on a specific item when it shows up. It only works when the item is within 20items difference from the first one, if it is further it doesnt work. How do i set the focus on a remote item ?

aurimasmi commented 7 months ago

Can you tell what property/method you are using to set focus on any non first item?

saimirg commented 7 months ago

I tried the focusOptions.hasPreferredFocus

aurimasmi commented 6 months ago

Right. hasPreferredFocus only on visible items and recycler has only certain amount of items visible initially. This is valid functionality what you asking I will add it to mine backlog and will do it

saimirg commented 5 months ago

hi @aurimasmi is there any workaround to it ? Is there any to fix it in the near future ?

saimirg commented 5 months ago

hi @aurimasmi , i'm using initialScrollIndex and it seem to be doing the work, but only when you scroll right afterward. If you scroll left, it kind of repeats its self. It takes you back to the initial scroll index. Is there any hack to this ? This is the implementation:

<FlashList
    data={channels}
    renderItem={rowRenderer}
    horizontal
    type="row"
    estimatedItemSize={Dimensions.get("window").width / 1}
    initialScrollIndex={50}
/>