2017-01-15 13 views
0

私はreact-nativeを使用しています。私の入力フィールドはフルで表示されませんwidthなぜですか?しかし、IOSをチェックすると、入力フィールドを全幅で正しく表示できます。 はここhttps://rnplay.org/apps/aHRkHAなぜ入力フィールドがアンドロイドで全幅を表示しないのですか?

import React from 'react'; 
import { 
    registerComponent, 
} from 'react-native-playground'; 
import { 
    StatusBar, 
    StyleSheet, 
    Text, 
    TextInput, 
    View, 
} from 'react-native'; 

class App extends React.Component { 
    render() { 
    return (
      <View style={styles.container}> 

       <Text style={styles.heading}> Login</Text> 
       <TextInput 
        style={styles.loginInput} 
        placeholder="Type here to translate!" 
       /> 
      </View> 
    ); 
    } 
} 

const styles = StyleSheet.create({ 
    container: { 
     backgroundColor: '#EF501E', 
     flex: 1, 
     alignItems: 'center' 
    }, 
    logo: { 
     width: 50, 
     height: 50 
    }, 
    heading: { 
     fontSize: 30, 
     marginTop: 20 
    }, 
    loginInput: { 
     height: 50, 
     borderWidth: 1, 
     borderColor: '#33090C', 
     flexDirection: 'row', 
     justifyContent: 'center', 
    } 
}); 

registerComponent(App); 

答えて

1

私のコード ある<TextInput>ためalignSelf: 'stretch'を持つ親のalignItems: 'center'をオーバーライドしてみてください。

<View style={styles.container}> 
    ... 

    <View style={{alignSelf: 'stretch'}}> 
    <TextInput 
     style={styles.loginInput} 
     placeholder="Type here to translate!" 
    /> 
    </View> 
</View> 
+0

のplsは私のコードを更新ND – user944513

+0

は申し訳ありませんが、私はRN遊び場を使用していない共有しています。あなた自身を更新できますか? –

関連する問題