Skip to content

Commit 819c91e

Browse files
committed
add rn-tester ScrollViewIndicatorInsets example to demonstrate the affect of iOS 13 automaticallyAdjustsScrollIndicatorInsets=NO
1 parent da80e37 commit 819c91e

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
'use strict';
2+
3+
const React = require('react');
4+
5+
const {
6+
Button,
7+
Modal,
8+
ScrollView,
9+
StyleSheet,
10+
View,
11+
} = require('react-native');
12+
13+
class ScrollViewIndicatorInsetsExample extends React.Component<
14+
{...},
15+
{|
16+
modalVisible: boolean,
17+
|},
18+
> {
19+
state = {
20+
modalVisible: false,
21+
};
22+
23+
_setModalVisible = visible => {
24+
this.setState({modalVisible: visible});
25+
};
26+
27+
render() {
28+
return (
29+
<View>
30+
<Modal
31+
visible={this.state.modalVisible}
32+
onRequestClose={() => this._setModalVisible(false)}
33+
animationType="slide"
34+
supportedOrientations={['portrait', 'landscape']}>
35+
<View style={styles.modal}>
36+
<ScrollView
37+
style={styles.scrollView}>
38+
<View style={styles.scrollViewContent}>
39+
<Button
40+
onPress={() => this._setModalVisible(false)}
41+
title="Close"
42+
/>
43+
</View>
44+
</ScrollView>
45+
</View>
46+
</Modal>
47+
<Button
48+
onPress={() => this._setModalVisible(true)}
49+
title="Present Modal Screen with ScrollView"
50+
/>
51+
</View>
52+
);
53+
}
54+
}
55+
56+
const styles = StyleSheet.create({
57+
modal: {
58+
flex: 1,
59+
},
60+
scrollView: {
61+
flex: 1,
62+
height: 1000,
63+
},
64+
scrollViewContent: {
65+
alignItems: 'center',
66+
backgroundColor: '#ffaaaa',
67+
height: 2000,
68+
justifyContent: 'flex-start',
69+
paddingTop: 200,
70+
},
71+
});
72+
73+
exports.title = 'ScrollViewIndicatorInsets';
74+
exports.category = 'iOS';
75+
exports.description =
76+
'ScrollView indicator insets should ignore the device\'s safe area on all iOS versions.';
77+
exports.examples = [
78+
{
79+
title: '<ScrollView> Indicator Insets Example',
80+
render: (): React.Node => <ScrollViewIndicatorInsetsExample/>,
81+
},
82+
];

packages/rn-tester/js/utils/RNTesterList.ios.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ const ComponentExamples: Array<RNTesterExample> = [
118118
module: require('../examples/ScrollView/ScrollViewAnimatedExample'),
119119
supportsTVOS: true,
120120
},
121+
{
122+
key: 'ScrollViewIndicatorInsetsExample',
123+
module: require('../examples/ScrollView/ScrollViewIndicatorInsetsExample'),
124+
},
121125
{
122126
key: 'SectionList-inverted',
123127
module: require('../examples/SectionList/SectionList-inverted'),

0 commit comments

Comments
 (0)