Skip to content

Commit f643553

Browse files
committed
Add scroll view keyboard inset height test option
1 parent cf08565 commit f643553

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/rn-tester/js/examples/ScrollView/ScrollViewKeyboardInsetsExample.ios.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ export function ScrollViewKeyboardInsetsExample() {
2323
const [automaticallyAdjustKeyboardInsets, setAutomaticallyAdjustKeyboardInsets] = React.useState(true);
2424
const [flatList, setFlatList] = React.useState(false);
2525
const [inverted, setInverted] = React.useState(false);
26+
const [heightRestricted, setHeightRestricted] = React.useState(false);
2627

2728
const scrollViewProps = {
29+
style: heightRestricted && styles.scrollViewHeightRestricted,
2830
contentContainerStyle: styles.scrollViewContent,
2931
automaticallyAdjustKeyboardInsets: automaticallyAdjustKeyboardInsets,
3032
keyboardDismissMode: 'interactive',
@@ -67,6 +69,13 @@ export function ScrollViewKeyboardInsetsExample() {
6769
style={styles.controlSwitch}/>
6870
</View>
6971
)}
72+
<View style={styles.controlRow}>
73+
<Text><Text style={styles.code}>HeightRestricted</Text> is {heightRestricted + ''}</Text>
74+
<Switch
75+
onValueChange={v => setHeightRestricted(v)}
76+
value={heightRestricted}
77+
style={styles.controlSwitch}/>
78+
</View>
7079
<View style={styles.controlRow}>
7180
<TextInput placeholder={'Text input outside scroll view'} style={styles.controlTextInput} />
7281
</View>
@@ -94,6 +103,11 @@ const styles = StyleSheet.create({
94103
alignItems: 'stretch',
95104
justifyContent: 'flex-start',
96105
},
106+
scrollViewHeightRestricted: {
107+
marginVertical: 50,
108+
borderColor: '#f00',
109+
borderWidth: 1,
110+
},
97111
scrollViewContent: {
98112
paddingVertical: 5,
99113
paddingHorizontal: 10,

0 commit comments

Comments
 (0)