Skip to content

Commit 794d2a1

Browse files
committed
Make KeyboardTrackView Screen prettier
1 parent fba1424 commit 794d2a1

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
View,
77
TextField,
88
Image,
9+
Button,
910
Colors,
1011
Switch,
1112
Constants,
@@ -23,7 +24,8 @@ const URIs = [
2324
'https://static.pexels.com/photos/60628/flower-garden-blue-sky-hokkaido-japan-60628.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
2425
},
2526
{
26-
uri: 'https://images.pexels.com/photos/140234/pexels-photo-140234.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
27+
uri:
28+
'https://images.pexels.com/photos/140234/pexels-photo-140234.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
2729
}
2830
];
2931

@@ -42,25 +44,49 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
4244
const {trackInteractive} = this.state;
4345

4446
return (
45-
<View flex bg-dark80>
47+
<View flex bg-dark80 paddingT-page>
4648
<ScrollView
4749
contentContainerStyle={styles.scrollContainer}
4850
keyboardDismissMode={trackInteractive ? 'interactive' : 'none'}
4951
>
50-
<Text text40 dark10 marginV-20>
52+
<Text h1 dark10 marginB-s1>
5153
Keyboard Tracking View
5254
</Text>
53-
<View row marginV-20 centerV>
54-
<Text text60>Track interactive:</Text>
55-
<Switch value={trackInteractive} onValueChange={this.toggleTrackInteractive} marginL-10/>
55+
<Text marginB-s4 grey10>
56+
Attach a custom view to that will track the keyboard position
57+
</Text>
58+
<View row marginV-20 centerV spread>
59+
<Text text70>Dismiss Keyboard with Drag</Text>
60+
<Switch
61+
value={trackInteractive}
62+
onValueChange={this.toggleTrackInteractive}
63+
marginL-10
64+
/>
5665
</View>
5766
{URIs.map((uri, index) => (
58-
<Image style={styles.image} source={uri} key={index}/>
67+
<Image style={styles.image} source={uri} key={index} />
5968
))}
6069
</ScrollView>
61-
<KeyboardTrackingView style={styles.trackingToolbarContainer} trackInteractive={trackInteractive}>
62-
<View centerV bg-white paddingH-s5 paddingV-s2>
63-
<TextField text70 placeholder={'Message'} floatingPlaceholder floatOnFocus/>
70+
<KeyboardTrackingView
71+
style={styles.trackingToolbarContainer}
72+
trackInteractive={trackInteractive}
73+
>
74+
<View bg-white row spread centerV paddingH-s5 paddingV-s3>
75+
<TextField
76+
containerStyle={{
77+
flex: 1,
78+
backgroundColor: Colors.grey60,
79+
paddingVertical: Spacings.s2,
80+
paddingHorizontal: Spacings.s4,
81+
borderRadius: 8
82+
}}
83+
hideUnderline
84+
placeholder={'Message'}
85+
floatingPlaceholder={false}
86+
floatOnFocus
87+
enableErrors={false}
88+
/>
89+
<Button label="Send" link marginL-s4 />
6490
</View>
6591
</KeyboardTrackingView>
6692
</View>

0 commit comments

Comments
 (0)