我不确定为什么,但是在使用 <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}
/>
关于javascript - react native : Unable to change color of text within <TextInput> component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62666909/