Skip to content

Commit

Permalink
Add scrollEnabled example to RNTester (facebook#23409)
Browse files Browse the repository at this point in the history
Summary:
RNTester is missing a test for the scrollEnabled prop

[General] [Added] - Added RNTester ScrollView scrollEnabled prop test
Pull Request resolved: facebook#23409

Differential Revision: D14059824

Pulled By: hramos

fbshipit-source-id: 0287277b64aeac69c4aeba83dbb3f73be646ede7
  • Loading branch information
berickson1 authored and facebook-github-bot committed Feb 13, 2019
1 parent 7a6fe0c commit 08a6b57
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions RNTester/js/ScrollViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 08a6b57

Please sign in to comment.