我也遇到這個(gè)問題 借鑒一下別人的
react-native 使用TextInput標(biāo)簽時(shí)會(huì)遇到這個(gè)警告:
Warning: Failed prop type: Invalid prop value of type number supplied to Textinput, expected string in Textinput (at Appointmentnumber is: 112) in Appointmentnumber(created by Context. Consumen)in withnavigation(Appointmentnumber)(created bySceneview

image.png
在道具中你傳遞的是數(shù)值,你必須以字符串的形式傳遞它,所以這樣改進(jìn)一下代碼:
<TextInput
style={styles.textinput}
placeholder="站廳預(yù)約人數(shù)"
placeholderTextColor = "#cccccc"
keyboardType = "numeric"
value={`${this.state.num}`} //這里改進(jìn)一下就OK
onChangeText={(num)=> {this.setState({num})}}
/>
原文鏈接:https://blog.csdn.net/quhongqiang/article/details/88837813