mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 20:01:01 +08:00
Support snapToInterval for horizontal scrollview on Android
Summary: `snapToInterval` is available on iOS but on android yet. This PR is to add support for `snapToInterval` on android. Example:  TO: lelandrichardson spikebrehm Closes https://github.com/facebook/react-native/pull/10242 Differential Revision: D4168527 fbshipit-source-id: de3dd9ac5d9e0fddfce5e5bc0aa6a4f33f1e30b3
This commit is contained in:
committed by
Facebook Github Bot
parent
a8391bde7d
commit
ddd65f1ba9
@@ -46,6 +46,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}>
|
||||
@@ -72,7 +86,10 @@ var styles = StyleSheet.create({
|
||||
},
|
||||
horizontalItemWrapper: {
|
||||
padding: 50
|
||||
}
|
||||
},
|
||||
horizontalPagingItemWrapper: {
|
||||
width: 200,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = ScrollViewSimpleExample;
|
||||
|
||||
Reference in New Issue
Block a user