javascript - 如何在 react-native 中更改占位符 textSize

标签 javascript react-native

在我的 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/

相关文章:

javascript - 在 Gjs Gtk.Application 的命令行中处理作为参数传递的文件

javascript - 野蝇 10 AMQ119032 : User does not have permission CREATE_NON_DURABLE_QUEUE on address

javascript - 如何将sinon js注入(inject)到iFrame中的应用程序

javascript - 在 Typescript 中使用超出范围的函数

typescript - 需要在 KeyboardAvoidingView 中单击两次,即使 Keyboardshouldpersisttaps 始终为

android - 我已经在 native react 中构建了我的应用程序,但我想减小大小

android - react native 代码更改未反射(reflect)在设备上

javascript - 在 Fabricjs 中缩放对象时缺少图案质量

react-native - 如何在 native react 中自定义 Material 底部选项卡导航器?

javascript - 为此添加一些动态文本。在 native react 中