Closed
Description
Description
Added ScrollView to my component in this manner which works with pagination on android. But this I mean that as you swipe left or right the card gets centered to the screen on release.
<ScrollView
style={styles.container}
automaticallyAdjustInsets={false}
horizontal={true}
decelerationRate={0}
snapToInterval={CARD_WIDTH}
snapToAlignment="start"
contentContainerStyle={styles.content}
pagingEnabled={true}
>
<View style={styles.card}>
<Text>Card 1</Text>
</View>
<View style={styles.card}>
<Text>Card 2</Text>
</View>
<View style={styles.card}>
<Text>Card 3</Text>
</View>
<View style={styles.card}>
<Text>Card 4</Text>
</View>
</ScrollView>
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
content: {
alignItems: 'center',
},
card: {
flex: 1,
backgroundColor: '#ccc',
width: CARD_WIDTH,
height: CARD_WIDTH,
alignItems: 'center',
justifyContent: 'center',
}
}
Reproduction
But when changing horizontal={false}
in the ScrollView component, the view scroll up and down but the pagination no longer works.
Solution
Identify how to retain the pagination experience on vertical scroll.
Additional Information
- React Native version: 0.36.1
- Platform: android
- Operating System: MacOSX 10.10