Skip to content

Commit eee22fc

Browse files
committed
KeyboardInputViewScreen refactor some styles etc
1 parent 7820849 commit eee22fc

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
import _ from 'lodash';
22
import React, {PureComponent} from 'react';
33
import {ScrollView, StyleSheet, TextInput} from 'react-native';
4-
import {
5-
Keyboard,
6-
TouchableOpacity,
7-
Text,
8-
View,
9-
TextField,
10-
Image,
11-
Colors,
12-
Spacings,
13-
Switch,
14-
Constants,
15-
Typography,
16-
Button
17-
} from 'react-native-ui-lib';
4+
import {Keyboard, Text, View, Colors, Spacings, Constants, Typography, Button} from 'react-native-ui-lib';
185
const KeyboardAccessoryView = Keyboard.KeyboardAccessoryView;
196
const KeyboardUtils = Keyboard.KeyboardUtils;
207

@@ -76,10 +63,16 @@ export default class KeyboardInputViewScreen extends PureComponent {
7663
});
7764
}
7865

66+
onHeightChanged = keyboardAccessoryViewHeight => {
67+
if (Constants.isIOS) {
68+
this.setState({keyboardAccessoryViewHeight});
69+
}
70+
};
71+
7972
keyboardAccessoryViewContent = () => {
8073
return (
8174
<View style={styles.keyboardContainer}>
82-
<View style={styles.inputContainer}>
75+
<View row padding-s5>
8376
<TextInput
8477
maxHeight={200}
8578
style={styles.textInput}
@@ -93,7 +86,7 @@ export default class KeyboardInputViewScreen extends PureComponent {
9386
<Button label="Close" link onPress={KeyboardUtils.dismiss} style={styles.button}/>
9487
</View>
9588

96-
<View style={styles.keyboardModesContainer}>
89+
<View row>
9790
{this.getToolbarButtons().map((button, index) => (
9891
<Button label={button.text} link onPress={button.onPress} key={index} style={styles.button}/>
9992
))}
@@ -104,7 +97,7 @@ export default class KeyboardInputViewScreen extends PureComponent {
10497

10598
render() {
10699
return (
107-
<View style={styles.container}>
100+
<View flex bg-dark80>
108101
<ScrollView
109102
contentContainerStyle={styles.scrollContainer}
110103
keyboardDismissMode={TrackInteractive ? 'interactive' : 'none'}
@@ -117,7 +110,7 @@ export default class KeyboardInputViewScreen extends PureComponent {
117110

118111
<KeyboardAccessoryView
119112
renderContent={this.keyboardAccessoryViewContent}
120-
onHeightChanged={Constants.isIOS ? height => this.setState({keyboardAccessoryViewHeight: height}) : undefined}
113+
onHeightChanged={this.onHeightChanged}
121114
trackInteractive={TrackInteractive}
122115
kbInputRef={this.textInputRef}
123116
kbComponent={this.state.customKeyboard.component}
@@ -132,21 +125,11 @@ export default class KeyboardInputViewScreen extends PureComponent {
132125
}
133126

134127
const styles = StyleSheet.create({
135-
container: {
136-
flex: 1,
137-
backgroundColor: Colors.dark80
138-
},
139128
scrollContainer: {
140129
paddingHorizontal: Spacings.s5,
141130
flex: 1,
142131
justifyContent: 'center'
143132
},
144-
inputContainer: {
145-
flexDirection: 'row',
146-
alignItems: 'center',
147-
justifyContent: 'space-between',
148-
padding: Spacings.s5
149-
},
150133
textInput: {
151134
flex: 1,
152135
padding: Spacings.s2,
@@ -159,8 +142,5 @@ const styles = StyleSheet.create({
159142
backgroundColor: Colors.white,
160143
borderWidth: 1,
161144
borderColor: Colors.dark60
162-
},
163-
keyboardModesContainer: {
164-
flexDirection: 'row'
165145
}
166146
});

0 commit comments

Comments
 (0)