我正在尝试在 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'
}
});
最佳答案
添加 autoCorrect={false} 应该删除下划线,但在某些 Android 设备中它不会像本 link 中描述的那样工作
尝试一下它是有效的
autoCorrect={false}
keyboardType="visible-password"
关于android - 如何禁用文本输入中文本下的行 android react native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57745197/