Using React native 0.26,
My component is something like this
const Search = () => { return ( <View style={styles.backgroundImage}> <TextInput style={styles.textInput} onChangeText={(text) => console.log(text)} placeholder={"Enter Search Term"}/> </View> ) }
And my styles :
const styles = StyleSheet.create({ backgroundImage: { flex : 1, flexDirection: "column", justifyContent: 'center', alignItems: 'center' }, textInput: { justifyContent: "center", alignItems: "stretch", borderRightWidth: 30, borderLeftWidth: 30, height: 50, borderColor: "#FFFFFF", } })
The problems that I am facing are
returnKeyType
and see how the keyboard looks (and have some code on onSubmitEditing
and test).Screenshot below :
1 You cannot declare a specific border directly on the TextInput unless multiline is enabled (For example borderLeftWidth
will not work unless multiline={true}
is enabled but borderWidth
will work), but you can just wrap the TextInput in a View and give it a border.
inputContainer: { borderLeftWidth: 4, borderRightWidth: 4, height: 70 }, input: { height: 70, backgroundColor: '#ffffff', paddingLeft: 15, paddingRight: 15 }
2 You need to declare a backgroundColor
for the TextInput.
3 To make the native keyboard show up, you need to go to the simulator menu and disconnect your hardware. Go to Hardware -> Keyboard -> Connect Hardware Keyboard, toggle it off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With