react-native

react-native 安卓textinput 光标不显示和自

2019-01-29  本文已影响0人  HT_Jonson
                     <TextInput
                            ref={'InputText'}
                            style={styles.textInputStyle}
                            placeholder="请输入手机号"
                            clearButtonMode="while-editing"
                            selectionColor={'blue'} //这里可以设置ios的光标颜色
                            keyboardType='numeric'
                            maxLength={11}
                            underlineColorAndroid={'transparent'}
                          
                        />

ios的 textinput 光标色 可以自定义,但是安卓的却 不显示.....
试了很多方法没解决....
最后只能寻找原生方法了

首先 你可以去android / app / src / main / res / values / styles.xml中.
找到如下代码

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <!-- 添加如下一行代码,这样就可以设置全局的textinput 光标色 -->
        <item name="colorControlActivated">@color/blue</item>
    </style>

修改后的小伙伴可以看看了
请注意这个是全局的光标色

上一篇 下一篇

猜你喜欢

热点阅读