我希望文本输入的下划线占位符长于文本,使其看起来整洁。但是,仅当用户键入更多字母时,它才会扩展。有什么办法可以将其设置为默认值吗?
我遇到的另一个问题是,在我的password text input中,它没有显示所有文本,而只是显示了PASSWOR。
这是我的文本输入代码:
<View
style={styles.inputContainer}
>
{/** USERNAME TEXT INPUT**/}
<TextInput
style={styles.usernameInput}
placeholder= "USERNAME"
placeholderTextColor='white'
maxLength= {15}
autoCorrect={false}
underlineColorAndroid='blue'
>
</TextInput>
{/** PASSWORD TEXT INPUT**/}
<TextInput
style={styles.passwordInput}
placeholder= "PASSWORD"
placeholderTextColor='white'
maxLength= {15}
autoCorrect={false}
underlineColorAndroid='blue'
secureTextEntry={true}
>
</TextInput>
</View>
这是我的样式代码:
const styles = StyleSheet.create({
Container: {
flex: 1,
width: null,
height: null,
alignItems: 'center',
justifyContent: 'center',
},
inputContainer: {
height: '80%',
width: '80%',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'rgba(216,69,69,0.8)',
borderRadius: 50,
},
usernameInput: {
fontFamily: "Montserrat",
fontSize: 20,
color: 'white',
fontWeight: 'bold',
},
passwordInput: {
fontFamily: "Montserrat",
fontSize: 20,
color: 'white',
fontWeight: 'bold',
},
答案 0 :(得分:0)
您可以这样更改styleSheet并告诉我结果吗?
Container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
inputContainer: {
height: 120,
width: 120,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'rgba(216,69,69,0.8)',
borderRadius: 50,
},
usernameInput: {
fontFamily: "Montserrat",
width: 120,
fontSize: 20,
color: 'white',
fontWeight: 'bold',
},
passwordInput: {
fontFamily: "Montserrat",
fontSize: 20,
width: 120,
color: 'white',
fontWeight: 'bold',
},