繁体   English   中英

React Native:无法更改文本的颜色<textinput>零件</textinput>

[英]React Native: Unable to change color of text within <TextInput> component

我不知道为什么,但是在使用<TextInput>组件时,我无法使用标准style={{color: '#HEX'}}更改输入文本的颜色。

这是一个例子:

          <TextInput
            style={{
              backgroundColor: 'transparent',
              color: '#fff',
              borderBottomWidth: 0,
            }}
            keyboardAppearance={'dark'}
            keyboardType={'numeric'}
            selectionColor='#fff'
            underlineColor="rgba(0,0,0,0)"
            underlineColorAndroid="rgba(0,0,0,0)"

            placeholderTextColor="#fff"

          />

还有一个非常烦人的紫色下划线,我似乎无法摆脱。 我需要为此使用某种特殊属性吗?

对于文本颜色,试试这个theme={{ colors: { text: '#fff' } }} ; 对于下划线,请尝试autoCorrect={false}

代码


<TextInput
   theme={{ colors: { text: '#fff' } }}
   autoCorrect={false}
  />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM