Support snapToInterval for horizontal scroll view on android

This commit is contained in:
Jimmy Zhuang
2017-02-06 16:56:57 -08:00
committed by Leland Richardson
parent 936d72a9c7
commit 70bb4624f1
4 changed files with 39 additions and 4 deletions
@@ -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;