android - 如何禁用文本输入中文本下的行 android react native

标签 android reactjs react-native

我正在尝试在 react-native(android) 中呈现一个文本输入,它下面有一行来自 borderBottomWidth 属性 put 当我打字时,出现了两行看起来不很好,无法删除它我尝试提供 underlineColorAndroid='transparent' 但没有用

import * as React from 'react';
import { Text, View, StyleSheet,TextInput } from 'react-native';
import Constants from 'expo-constants';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TextInput
          autoCapitalize='none'
          autoCorrect={false}
          underlineColorAndroid='rgba(0,0,0,0)'
          style={styles.textInput}
         />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#000',
    padding: 8,
  },
  textInput: {
    paddingVertical: 0,
    marginHorizontal: 10,
    textAlign: 'center',
    height: 18,
    fontSize: 14,
    alignSelf: 'flex-start',
    borderStyle: 'solid',
    borderWidth:0,
    borderBottomWidth: 1,
    color: '#1ac9e8',
    minWidth: 48,
    borderColor: '#1ac9e8',
    fontFamily: 'Monaco'
  }
});

https://snack.expo.io/rylmazFSH

任何解决方法? picture

最佳答案

添加 autoCorrect={false} 应该删除下划线,但在某些 Android 设备中它不会像本 link 中描述的那样工作

尝试一下它是有效的

autoCorrect={false}
keyboardType="visible-password"

小吃链接:https://snack.expo.io/@mehran.khan/underline-android

关于android - 如何禁用文本输入中文本下的行 android react native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57745197/

相关文章:

typescript - 在堆栈之间导航时 React Navigation 5 类型错误

React-Native Android Release构建错误: unknown option `--configuration'

android - 创建自定义凸路径Android

android - 如何将对象添加到静态数组中

android - 在 react native ListView 上显示多种类型的行的正确方法是什么?

html - 滚动条没有一直滚动到我的表格底部

javascript - 为什么我的 reactJs 没有重新渲染

java - 无法使用我的服务对象连接到我的谷歌端点

javascript - React 中 N 个文件输入的添加和删除

css - 使用 flexbox 控制组件放置