mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support snapToInterval for horizontal scroll view on android
This commit is contained in:
committed by
Leland Richardson
parent
936d72a9c7
commit
70bb4624f1
@@ -57,6 +57,20 @@ class ScrollViewSimpleExample extends React.Component {
|
||||
{this.makeItems(NUM_ITEMS, [styles.itemWrapper, styles.horizontalItemWrapper])}
|
||||
</ScrollView>
|
||||
);
|
||||
items.push(
|
||||
<ScrollView
|
||||
key={'scrollViewSnap'}
|
||||
horizontal
|
||||
snapToInterval={210}
|
||||
pagingEnabled
|
||||
>
|
||||
{this.makeItems(NUM_ITEMS, [
|
||||
styles.itemWrapper,
|
||||
styles.horizontalItemWrapper,
|
||||
styles.horizontalPagingItemWrapper,
|
||||
])}
|
||||
</ScrollView>
|
||||
);
|
||||
|
||||
var verticalScrollView = (
|
||||
<ScrollView style={styles.verticalScrollView}>
|
||||
@@ -83,7 +97,10 @@ var styles = StyleSheet.create({
|
||||
},
|
||||
horizontalItemWrapper: {
|
||||
padding: 50
|
||||
}
|
||||
},
|
||||
horizontalPagingItemWrapper: {
|
||||
width: 200,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = ScrollViewSimpleExample;
|
||||
|
||||
Reference in New Issue
Block a user