admin管理员组文章数量:1434949
I am using a horizontal FlatList combined with react-native-gesture-handler to implement pinch-to-zoom functionality. The pinch gesture works as expected, allowing me to zoom in and out of the content. However, the horizontal scroll of the FlatList is not working properly.
Problem: Initially, scrolling does not work when zoomed out. Scrolling starts working only after zooming in significantly.
<NativeViewGestureHandler disallowInterruption={true}>
<View style={styles.container} onLayout={onContainerLayout}>
<PinchGestureHandler onGestureEvent={handlePinch} onHandlerStateChange={handlePinchEnd}>
<View style={{ overflow: "hidden" }}>
<Animated.View style={[animatedStyle]}>
<FlatList
data={[{ labels, bars }]}
contentContainerStyle={styles.scrollViewContent}
scrollToOverflowEnabled
showsHorizontalScrollIndicator={false}
keyExtractor={(item, index) => `label-${index}`}
horizontal
onTouchStart={() => setOuterScrollEnabled(false)}
onTouchEnd={() => setOuterScrollEnabled(true)}
onTouchCancel={() => {
setOuterScrollEnabled(true);
}}
onStartShouldSetResponder={() => true}
onMoveShouldSetResponder={() => true}
onScroll={onScroll}
nestedScrollEnabled
decelerationRate="fast"
scrollEventThrottle={16}
renderItem={({ item }) => {
return (
<View style={[styles.timelineContainer, { minWidth: xScale(to!) }]}>
<View style={[styles.timeLabelsContainer]}>{renderLabels(item.labels)}</View>
<View style={[styles.barsContainer]}>{renderBars(item.bars)}</View>
</View>
);
}}
/>
</Animated.View>
</View>
</PinchGestureHandler>
</View>
</NativeViewGestureHandler>
What I’ve Tried: Updated react-native-gesture-handler and react-native-reanimated to the latest versions. Wrapped the entire FlatList inside a GestureHandlerRootView. Checked that scrollEnabled is dynamically set based on the zoom state. Verified that the contentContainerStyle of the FlatList is correctly set.
本文标签:
版权声明:本文标题:React Native FlatList Horizontal Scroll Not Working with Gesture Handler Pinch Zoom on Android Tablet (Android 14) - Stack Overf 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745629026a2667155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论