React native ReactNative:TextInput在FlexLayout中消失
我正在学习react native,当我试图在flex布局中使用TextInput组件时,它消失了 index.android.jsReact native ReactNative:TextInput在FlexLayout中消失,react-native,React Native,我正在学习react native,当我试图在flex布局中使用TextInput组件时,它消失了 index.android.js //.... render(){ return ( <View style={ {flex:1,flexDirection:'row'}}> <TextInput placeholder="test"/> </View> ) } //.... /。。。
//....
render(){
return (
<View style={ {flex:1,flexDirection:'row'}}>
<TextInput placeholder="test"/>
</View>
)
}
//....
/。。。。
render(){
返回(
)
}
//....
我很困惑。您需要在TextInput上设置一个高度:
<TextInput placeholder="test" style={{ height:60 }} />
我试图设置TextInput的高度,但它不起作用。 我终于成功地将宽度或{flex:1}设置为TextInput。
我想,当parant容器被设置为{flexDirection:“row”}时,TextInput的宽度是0,所以我看不到它。默认情况下,父容器的伸缩方向为“列”,TextInput元素调整自身的{flex:1}以填充父容器。非常好的解释。在痛苦地修补flexbox几个小时后找到了答案。。。。。。