I have an issue with TextInput in react native so when I submit to update, I am getting an error of ' Invalid prop value of type number supplied to ForwardRef(TextInput)'. May someone help me to solve this issue.
Error:
Warning: Failed prop type: Invalid prop
value
of typenumber
supplied toForwardRef(TextInput)
, expectedstring
. at node_modules\react-native\Libraries\LogBox\LogBox.js:173:8 in registerError
Here is my code :
const [Phase, setPhase] = useState('')
const [Days, setDay] = useState(null)
const [TempMin, setTempMin] = useState(null)
<TextInput
style={styles.input}
onChangeText={(text) => setPhase(text)}
placeholder={plants.Phase}
value={Phase}
name="Phase"
selectTextOnFocus={false}
editable={false}
/>
<Text style={styles.titleInput}>Nombre de jour</Text>
<TextInput
style={styles.input}
onChangeText={(text) => setDay(text)}
keyboardType='numeric'
placeholder={`${plants.Days}`}
value={Days}
name="Days"
/>
<Text style={styles.titleInput}>T° Min</Text>
<TextInput
style={styles.input}
onChangeText={(text) => setTempMin(text)}
keyboardType='numeric'
placeholder={`${plants.TempMin}`}
value={TempMin}
name="TempMin"
/>
CodePudding user response:
value={String(Days)}
or
if(String(Days)){....}