-
Notifications
You must be signed in to change notification settings - Fork 155
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
Error: "Invariant Violation: scrollToIndex out of range: requested index 228 is out of 0 to 148" #156
Comments
@jonqwerty Have you been able to solve this? Facing same issue |
@HERYORDEJY-DEV I didn't solve this problem, but I avoided it. As I understand it, this error occurs when autoscrolling to the selected item and when the length of the list is more than 50 items (determined experimentally). How to avoid it: autoScroll={false}. But then autoscroll will not be working :) |
hi @jonqwerty @HERYORDEJY-DEV , |
@hoaphantn7604 |
|
I have the same issue, on the The other workaround would be to provide flatListProps={{
getItemLayout: (data, index) => ({
length: itemHeight,
offset: itemHeight * index,
index,
}),
}} |
@wilkuintheair can you help me fix this error. i didn't find flatListProps |
Same error happening with [email protected] getting this error please help. |
Did you find any other way to fix this code even i am getting the same error |
I placed the problem code in try catch.it stops the crash ===> try{ in scrollIndex function |
The solution that worked for me is add this prop in your dropdown, where itemHeight = 50. This hack is surely gonna work. flatListProps={{ Also apply add height to your dropdown style. I have added |
add autoScroll={false} |
Hi, I use react-native-element-dropdown. Data for displaying in dropdown counts about 300 items. From time to time I receive error : "Invariant Violation: scrollToIndex out of range: requested index 228 is out of 0 to 148" when I use search.
Here is code
`
"react-native": "0.70.5",
"react-native-element-dropdown": "^2.3.0",
Is there any way to fix this?
The text was updated successfully, but these errors were encountered: