[v3][v4] BottomSheetFlatList (scrollToOffset or scrollToIndex) scrolling to 0 when BottomSheet is collapsed
See original GitHub issueBug
https://user-images.githubusercontent.com/3524824/129570109-e3808f8d-00f9-49dc-9812-2f0e37401804.mp4
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | ^4.0.0-alpha.27 |
react-native | ^0.64.2 |
react-native-reanimated | ^2.3.0-alpha.2 |
react-native-gesture-handler | ^1.10.3 |
Steps To Reproduce
when run ref.current?.scrollToOffset({animated: true, offset: 400}) it should change the y to 400 but this only work when expanded
Describe what you expected to happen:
Change the y position to selected offset.
Reproducible sample code
import BottomSheet, {BottomSheetFlatList} from '@gorhom/bottom-sheet'
import React, {useRef} from 'react'
import {FlatList, View, Text, StyleSheet} from 'react-native'
export default function CaricatureScreen({navigation}: Props) {
const ref = useRef<FlatList | null>(null)
const data = ['Test 1', 'Test 2', 'Test 3', 'Test 4', 'Test 5']
const styles = StyleSheet.create({
view: {
height: 200,
flex: 1,
},
}
setInterval(() => ref.current?.scrollToOffset({animated: true, offset: 400}), 1000)
return (
<BottomSheet index={0} snapPoints={[100, '70%']}>
<BottomSheetFlatList
ref={ref}
data={data}
renderItem={({index, item}) => (
<View style={styles.view}>
<Text>{item}</Text>
</View>
)}
/>
</BottomSheet>
)
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
BottomSheetFlatList ref.current.scrollToIndex not scrolling #414
I seems to be unable to make a BottomSheetFlatList scroll to a specific index with restaurantListRef.current?.scrollToIndex({index}); .
Read more >Scrollview not scrolling in Android bottomsheet - Stack Overflow
Every time I try to scroll, either the layout in main activity that scroll or the BottomSheet changing state from collapse to expand....
Read more >Scrollables | React Native Bottom Sheet - GitHub Pages
This library provides a pre-integrated virtualized lists that utilize an internal functionalities with the bottom sheet container to allow smooth panning ...
Read more >react-native-scroll-bottom-sheet - npm
Cross platform scrollable bottom sheet with virtualization support, running at 60 FPS and fully implemented in JS land.
Read more >React Native scrollToIndex - Dynamic size item scroll inside ...
In this video tutorial you will learn about React Native scrollToIndex and how to scroll to an item inside a FlatList, ListView, ScrollView, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would also like to know how to scroll to a specific index
Was there any solution for this issue. I’m encountering something similar.
ref.current.scrollToIndex
only works when the bottom sheet is expanded to the final snap point.