mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-19 11:38:35 +08:00
Add scrollEnabled example to RNTester (#23409)
Summary: RNTester is missing a test for the scrollEnabled prop [General] [Added] - Added RNTester ScrollView scrollEnabled prop test Pull Request resolved: https://github.com/facebook/react-native/pull/23409 Differential Revision: D14059824 Pulled By: hramos fbshipit-source-id: 0287277b64aeac69c4aeba83dbb3f73be646ede7
This commit is contained in:
committed by
Facebook Github Bot
parent
7a6fe0cda0
commit
08a6b573f7
Binary file not shown.
|
Before Width: | Height: | Size: 286 KiB After Width: | Height: | Size: 296 KiB |
@@ -126,6 +126,45 @@ exports.examples = [
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '<ScrollView> enable & disable\n',
|
||||
description: 'ScrollView scrolling behaviour can be disabled and enabled',
|
||||
render: function() {
|
||||
class EnableDisableList extends React.Component<{}, *> {
|
||||
state = {
|
||||
scrollEnabled: true,
|
||||
};
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<ScrollView
|
||||
automaticallyAdjustContentInsets={false}
|
||||
style={styles.scrollView}
|
||||
scrollEnabled={this.state.scrollEnabled}>
|
||||
{THUMB_URLS.map(createThumbRow)}
|
||||
</ScrollView>
|
||||
<Text>
|
||||
{'Scrolling enabled = ' + this.state.scrollEnabled.toString()}
|
||||
</Text>
|
||||
<Button
|
||||
label="Disable Scrolling"
|
||||
onPress={() => {
|
||||
this.setState({scrollEnabled: false});
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
label="Enable Scrolling"
|
||||
onPress={() => {
|
||||
this.setState({scrollEnabled: true});
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
return <EnableDisableList />;
|
||||
},
|
||||
},
|
||||
];
|
||||
if (Platform.OS === 'ios') {
|
||||
exports.examples.push({
|
||||
|
||||
Reference in New Issue
Block a user