在我的 TextInput
中,我想更改 placeHolder
的字体大小,我试过这样:
<TextInput
style={styles.email}
value={this.state.email}
placeholder="Email"
placeholderTextColor="red"
//placeholderTextSize = 20px
onChange={this.handleEmailChange.bind(this)}
onBlur={this.onBlur.bind(this)}/>
当我写这样的颜色对我有用但大小不起作用时,任何人都可以给我建议如何更改占位符文本的大小,非常感谢任何帮助
最佳答案
我不确定您是否可以只指定 placeholderText 的大小。但是您可以从 TextInput 更改输入文本的字体大小:
var styles = StyleSheet.create({
email: {
fontSize: 12, <-- Textsize of Input-Text and Placeholder-Text
},
})
也许您的解决方案在没有 px 的情况下也能奏效?!但我不这么认为。如果您想使用与 InputText 不同的 PlaceholderText,那么您可以访问 TextInput 的 onChangeText-Method,并在您向 Textfield 中键入内容后立即更改 fontSize。
关于javascript - 如何在 react-native 中更改占位符 textSize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33515911/