I'm working on a project which has some text fields(textInput). I'm encountering an issue with the textInput fields here. While I type in the textInput field the text is having an underline which is getting even more darker when I hit space and I want to remove that underline from it.
Here is a screenshot:
This is my code:
<TextInput
style={Style.InputStyle}
multiline={true}
placeholderTextColor={'#DC1938'}
placeholder={'Name'}
spellCheck={false}
underlineColorAndroid='rgba(255,0,0,0.3)'
inlineImageLeft='userred'
inlineImagePadding={25}
padding={15}
/>
Try Following props.
spellCheck={false}
autoCorrect={false}
Please refer the following link :
disable spellcheck in react-native TextInput
Hello guys i have found the answer it was the autoCorrect prop. i disabled it and yeah it worked!
Use underlineColorAndroid props
<TextInput underlineColorAndroid='transparent'
placeholder="type here ..">
This is some text you want to render
</TextInput>
An explanation why this happens can be found here.
Related
I have a form with multiline TeaxtInput field.
<TextInput
multiline={true}
editable={false}
numberOfLines={5}
/>
When the form is approved, all fields are not editable. But the problem is unable to scroll multiline TextInput field since it is not editable. User faces difficulties to read the complete text in the TextInput.
Hence, Is there any way to scroll multiline TextInput when editable={false}?
Maybe issue is in your other design code because TextInput is scrollable when editable = {false}, I've tried this and its working.
I want to add something like a Hint, on the textInput, as in java using android studio, in react native is it possible to do this? I know you have the option to add a Value, defaultValue and the placeholder, but they don't work like hint.
Tanks!
You can use placeholder props
<TextInput
placeholder="Input email"
/>
Yes it is possible, it's called placeholder, Here is an example from docs.:
<TextInput
style={{height: 40}}
placeholder="Type here to translate!"
onChangeText={(text) => this.setState({text})}
value={this.state.text}
/>
The only thing you need to do is to add a the placeholder prop.
<TextInput
...//otherprops
placeholder="enter your hint here"
/>
I highly suggest you to read more about TextInput in React Native docs here
I have a TextInput whith multiline={true}. I want to know how to get its placeholder text like:
Hey There!
Want any Help?
Placeholder To The Rescue!
I tried some like placeholder='Hey There!\nWant any Help?' but didn't get what i wanted.
I'm sort of new to React Native. Helps would be greatly appreciated!
Found An Answer! Using braces made it render what I wanted. I figured out that React Native renders strings here as it is, but with the formatting given, if inside braces. For eg:
<TextInput
multiline={true}
placeholder='Hey There!\nHow are You?'
/>
With the above code rendered, the TextInput will look like:
HeyThere!\nHow are You?
But if you use braces like this:
<TextInput
multiline={true}
placeholder={'Hey There!\nHow are You?'}
/>
Then You will get the TextInput like:
Hey There!
How are You?
And That's Exactly what I wanted!
Well, Thank You Folks for Replying!
<TextInput
multiline={true}
placeholder={'Hey There! \nWant any Help? \nPlaceholder To The Rescue!'}
style={{height: 40, borderColor: 'gray', borderWidth: 1,fontSize:12}}
/>
try to use textarea html tag.That allow you to do multiline placeholder.
I want to remove the underline of a TextInput of my react-native application. I tried with borderBottomWidth but it did not work. How can I achieve this on Android and IOS.
Its really simple
In iOS we dont have underline.
and for android just add this prop
<TextInput underlineColorAndroid={'rgba(0,0,0,0)'}> </TextInput>
<TextInput underlineColorAndroid='transparent'>
by this you can remove it.
You should set borderWidth: 0
Example:
<TextInput
style={{borderWidth: 0}}
/>
The solution I found in code inspection is on the TextInput, you could use the :
inputContainerStyle={{borderBottomWidth:0}}
I want keyboard not to show up at all when i touch my text input.If i use 'Keyboard.dismiss' i loose the focus on my text input i am using custom keyboard which itself is part of my screen so i don't want any keyboard to show up at all without loosing the focus on my text input, any solution please.I have tried using libraries but facing same problems again and again what should i do. Here the code i Am using
<TextInput onFocus={Keyboard.dismiss}>
Use <TextInput showSoftInputOnFocus={false} />
It will hide the keyboard when you focus on the text input.
ReactNative TextInput has showSoftInputOnFocus prop, which is due to docs should hide keyboard. But seems like it doesn't work.
I found this solution, works for me:
<>
<TouchableWithoutFeedback onPress={this.toggleVisible}>
<View>
<View pointerEvents="none">
<Input
value={String(value)}
placeholder={placeholder}
/>
</View>
</View>
</TouchableWithoutFeedback>
<DateTimePicker
isVisible={this.state.visible}
onConfirm={onChange}
onCancel={this.toggleVisible}
/>
Correct way is to encapsulate View with keyboard is calling Keyboard.dismiss()
you should use TouchableWithoutFeedback so that on clicking it should disable
the keyboard
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<TextInput keyboardType='numeric'/>
</TouchableWithoutFeedback>
Try this may be it can solve the problem