TextInputコンポーネントのプレースホルダテキストを揃える理由は何ですか?私はすでにスタイルコンポーネントを以下のように使用しようとしています。このためにも、そのようなものがないようです。TextInput placeHolder Alignment
render() {
return (
<View style={styles.container}>
<View style={styles.container}>
<TextInput
style={styles.textInput}
onChangeText={(text) => this.setState({
username: text
})}
placeholder='Add Username'
/>
<Button onPress= {_ => this.onClick() } style={styles.button} >
+ Add User
</Button>
</View>
</View>
);
}
onClick(){
alert(this.state.username);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
textInput: {
height: 40,
width: 200,
justifyContent: 'center',
alignItems: 'center',
alignSelf: 'center',
borderColor: 'gray',
borderWidth: 1,
},
button: {
backgroundColor: 'grey',
color: 'black',
fontSize: 15,
width: 200,
borderWidth: 1
},
});
私の場合、テキストは中央に配置されていません。私はマテリアルキットを使用しています。何が問題なのでしょうか?またはそれはうまく働いています – santhosh