Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactNative: TextInput disappear in FlexLayout

Tags:

react-native

I'm learning react-native,when I trying to use TextInput component in a flex layout, it disappear .

index.android.js

//....
render(){
    return (
        <View style={  {flex:1,flexDirection:'row'}}>
            <TextInput placeholder="test"/>
        </View>
    )
}

//....

I was very confused.

like image 647
Star丶Xing Avatar asked Mar 02 '16 09:03

Star丶Xing


1 Answers

I tried to set TextInput's height , but it doesn't work. And I finally success to set width or {flex:1} to TextInput. I think, when the parant container been set {flexDirection:"row"}, TextInput's width is 0, so I can't see it. By default,the parent container's flex direction is 'column',TextInput Element adjust itself's {flex:1} to fill the parent container.

like image 100
Star丶Xing Avatar answered Sep 30 '22 18:09

Star丶Xing