简体   繁体   English

react-native:如何在 Android 设备上的 TextInput 组件中输入文本时删除下划线?

[英]react-native: How to remove underline while typing text in TextInput Component on android device?

I want to remove underline while typing text inside the react native TextInput component on android device.我想在 android 设备上的 react native TextInput 组件中输入文本时删除下划线。 Text underline removes as soon as press enter or spacebar.按下回车键或空格键后,文本下划线会立即删除。 It's just showing until we type that word.它只是显示,直到我们输入那个词。

I have tried these options below:我在下面尝试了这些选项:

  • autoCorrect={false}自动更正={假}
  • spellCheck={false}拼写检查={假}
  • underlineColorAndroid="transparent" underlineColorAndroid="透明"
  • underlineColorAndroid="rgba(0,0,0,0)" underlineColorAndroid="rgba(0,0,0,0)"
<TextInput
  autoCorrect={false}
  spellCheck={false}
  underlineColorAndroid="transparent"
  placeholder="Username"
  style={styles.textInput}
/>

And my styles还有我的风格

 const styles = StyleSheet.create({
  textInput: {
    fontSize: 18,
    fontFamily: Platform.OS === "android" ? "Roboto" : "Avenir",
    color: colors.dark,
  }
 })

This is probably not a feature of keyboard app because in other app it is not showing the underline.这可能不是键盘应用程序的功能,因为在其他应用程序中它没有显示下划线。

image showing text input with underline text显示带有下划线文本的文本输入的图像

It's normal react-native behavior, but you can bypass it with:这是正常的本机反应行为,但您可以通过以下方式绕过它:

keyboardType="visible-password"

Only caveat is that this disables multiline.唯一需要注意的是,这会禁用多行。

只需简单地使用:

underlineColorAndroid="transparent"

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

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