-
-
Notifications
You must be signed in to change notification settings - Fork 788
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
[Bug]: initialScrollIndex
on BottomSheetFlatList or BottomSheetFlashList does not work correctly
#2026
Comments
Workaround for import { ScrollView as RNGHScrollView } from 'react-native-gesture-handler';
import { ScrollViewProps } from 'react-native';
const HEIGHT = 300
const DATA = [...] and then: <BottomSheetModal enableDynamicSizing={false} snapPoints={[HEIGHT * 1.75]}>
<FlashList
data={DATA}
estimatedItemSize={HEIGHT}
initialScrollIndex={50}
renderItem={renderItem}
renderScrollComponent={RNGHScrollView as ComponentType<ScrollViewProps>}
/>
</BottomSheetModal> |
Workaround also works for only this way |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
problem is still valid |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
iOS, Android
What happened?
When adding the
initialScrollIndex
prop to theBottomSheetFlatList
with a value that is outside of the render distance (50 in the video), the flatlist is not rendered correctly.If one starts to scroll, the flatlist will be rendered, but starts at the top of the list and not at the desired index.
If the
initialScrollIndex
is in the initial render distance (e.g. "2" in the snack), then the list will be rendered correctly, but the list also won't start from the given index.So the error possibly might be in the scroll position at render time?
ScreenRecording_11-05-2024.13-22-04_1.MP4
Reproduction steps
add
initialScrollIndex
to theBottomSheetFlatList
orBottomSheetFlashList
with a value that is outside of the initial render distanceReproduction sample
https://snack.expo.dev/@daniel.h/flatlist-bug-snack
Relevant log output
No response
The text was updated successfully, but these errors were encountered: