我正在学习本机反应,当我尝试在flex布局中使用TextInput组件时,它会消失. index.android.js //....render(){ return ( View style={ {flex:1,flexDirection:'row'}} TextInput placeholder="test"/ /View )}//.... 我很困惑. 我
index.android.js
//....
render(){
return (
<View style={ {flex:1,flexDirection:'row'}}>
<TextInput placeholder="test"/>
</View>
)
}
//....
我很困惑.
我试图设置TextInput的高度,但它不起作用. 我最终成功地将宽度或{flex:1}设置为TextInput. 我认为,当parant容器设置为{flexDirection:“row”}时,TextInput的宽度为0,所以我看不到它.默认情况下,父容器的flex方向为’column’,TextInput Element调整自身的{flex:1}以填充父容器.