-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rn-tester ScrollViewIndicatorInsets example to demonstrate the af…
…fect of iOS 13 automaticallyAdjustsScrollIndicatorInsets=NO
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsExample.ios.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
'use strict'; | ||
|
||
const React = require('react'); | ||
|
||
const { | ||
Button, | ||
DeviceInfo, | ||
Modal, | ||
ScrollView, | ||
StyleSheet, | ||
Switch, | ||
Text, | ||
View, | ||
} = require('react-native'); | ||
|
||
class ScrollViewIndicatorInsetsExample extends React.Component< | ||
{...}, | ||
{| | ||
modalVisible: boolean | ||
|}, | ||
> { | ||
state = { | ||
modalVisible: false | ||
}; | ||
|
||
_setModalVisible = visible => { | ||
this.setState({modalVisible: visible}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<View> | ||
<Modal | ||
visible={this.state.modalVisible} | ||
onRequestClose={() => this._setModalVisible(false)} | ||
animationType="slide" | ||
supportedOrientations={['portrait', 'landscape']}> | ||
<View style={styles.modal}> | ||
<ScrollView | ||
style={styles.scrollView}> | ||
<View style={styles.scrollViewContent}> | ||
<Button | ||
onPress={() => this._setModalVisible(false)} | ||
title="Close" | ||
/> | ||
</View> | ||
</ScrollView> | ||
</View> | ||
</Modal> | ||
<Button | ||
onPress={() => this._setModalVisible(true)} | ||
title="Present Modal Screen with ScrollView" | ||
/> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
modal: { | ||
flex: 1, | ||
}, | ||
scrollView: { | ||
flex: 1, | ||
height: 1000, | ||
}, | ||
scrollViewContent: { | ||
alignItems: 'center', | ||
backgroundColor: '#ffaaaa', | ||
height: 2000, | ||
justifyContent: 'flex-start', | ||
paddingTop: 200, | ||
}, | ||
}); | ||
|
||
exports.title = 'ScrollViewIndicatorInsets'; | ||
exports.category = 'iOS'; | ||
exports.description = | ||
'ScrollView indicator insets should ignore the device\'s safe area on all iOS versions.'; | ||
exports.examples = [ | ||
{ | ||
title: '<ScrollView> Indicator Insets Example', | ||
render: (): React.Node => <ScrollViewIndicatorInsetsExample/>, | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters