TextInput bileşeni için yer tutucu metnini hizalamanın en iyi yolu nedir? Aşağıda açıklanan stilleri bileşenini kullanmaya çalıştım. Bunun için de var ve özellik yok.TextInput placeHolder Hizalama
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
},
});
Metin benim durumumda hizalanmamış durumda malzeme seti kullanıyorum. Sorun ne olabilir? ya da iyi çalışıyor – santhosh