I want to make a text input field where placeholder text will show "Enter your digit" in react-native, Now problem is, the placeholder text is not showing until i am pressing any key in the keyboard. If i elaborate then when i am running the app placeholder text is empty, if i click on text input field then keyboard appears. Now if i press any digit then it shows those digit perfectly and if i press cross button and delete all digit which i entered only that time that placeholder text shows. I am new in react-native so if someone know about the problem then please explain before answer because so far i have not got any detail about this matter. So far what i have done.
<TextInput style={styles.textField} placeholder="Enter your digit" placeholderTextColor= 'red' keyboardType= 'numeric'> </TextInput>
I think it's because the textinput has some value in his value property, can you try to use value=''
?
<TextInput
style={styles.textField}
placeholder="Enter your digit"
placeholderTextColor= 'red'
value=''
keyboardType= 'numeric' />
If that works try using some state value like this.state.text, and make the initial value null or '' (empty string)
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