2017-04-05 8 views
1

iOSがテキスト入力コントロールの中央にないのはなぜですか?私はレンダリングとスタイルシート コードを含むています :TextInput Alignment Not Centered iOSリアクションネイティブ

left android, right ios

render() { 
    return (

    <View style={styles.container}> 
    <TextInput 
      style={styles.input} 
      onChangeText={(text) => this.setState({text})} 
      underlineColorAndroid='rgba(0,0,0,0)' 
      value={this.state.text} 
      placeholder= 'username' 
      /> 
    </View> 
) 
} 


    const styles = StyleSheet.create({ 
    container: { 
    flex: 1, 
    justifyContent: 'center', 
    alignItems: 'center', 
    backgroundColor: '#13493A' 
} 

input: { 
    height: 40, 
    width: 250, 
    borderRadius: 5, 
    backgroundColor: '#598176', 
    color: 'white', 
    marginTop: 30, 
    textAlign: 'center' 
    } 
}); 

は、課題追跡にみると、これが反応ネイティブ上のバグのように見える、事前に Anthonie

答えて

2

をありがとうiOS:#11892コードは動作するはずですが、そうではありません。 TextInputのスタイル(see example)にalignSelf: 'center'を追加することで、リストされた回避策があります。

関連する問題