-
Notifications
You must be signed in to change notification settings - Fork 1
/
useTextInput.js
37 lines (33 loc) · 913 Bytes
/
useTextInput.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import { View, TextInput } from 'react-native';
const UseTextInput = (props) => {
return (
<TextInput
{...props} // Inherit any props passed to it; e.g., multiline, numberOfLines below
editable
maxLength={40}
/>
);
}
const UseTextInputMultiline = () => {
const [value, onChangeText] = React.useState('Use Multiline Placeholder');
// If you type something in the text box that is a color, the background will change to that
// color.
return (
<View
style={{
backgroundColor: value,
borderBottomColor: '#000000',
borderBottomWidth: 1,
}}>
<UseTextInput
multiline
numberOfLines={4}
onChangeText={text => onChangeText(text)}
value={value}
style={{padding: 10}}
/>
</View>
);
}
export default UseTextInputMultiline;