Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set focus on long flashlist #190

Open
saimirg opened this issue Dec 4, 2023 · 5 comments
Open

Set focus on long flashlist #190

saimirg opened this issue Dec 4, 2023 · 5 comments

Comments

@saimirg
Copy link

saimirg commented Dec 4, 2023

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
Copy link
Contributor

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

@saimirg
Copy link
Author

saimirg commented Dec 8, 2023

I tried the focusOptions.hasPreferredFocus

@aurimasmi
Copy link
Contributor

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
Copy link
Author

saimirg commented Jan 26, 2024

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

@saimirg
Copy link
Author

saimirg commented Feb 5, 2024

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}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants