Fai*_*een 5 css reactjs react-native
我在我的 React Native 应用程序中使用 TextInput 并且占位符文本没有与其下方的边框对齐。占位符文本显示为距左侧缩进约 10 个像素。我们的 UX 不喜欢这样,并希望它与它下方的边框完全对齐。基本上,从左边开始,没有任何缩进。我已经对此进行了研究,但无法找到任何东西。有谁知道如何解决这一问题??
<View style={styles.emailInputBar}>
{this.state.showUsernameLabel &&
<Text style={styles.formLabel}>username</Text>
}
<TextInput
underlineColorAndroid="transparent"
style={styles.textInput}
placeholder="username"
placeholderTextColor="rgba(255,255,255,0.7)"
autoCorrect={false}
autoFocus={autoFocus}
returnKeyType={'next'}
autoCaptialize={'none'}
keyboardType={'email-address'}
enablesReturnKeyAutomatically={true}
onFocus={() => this.onFocus()}
onBlur={() => this.onBlur()}
onSubmitEditing={() => this.passwordInput.focus()}
onChangeText={(text) => this.handleUsernameChange(text)}
value={email}
/>
</View>
Run Code Online (Sandbox Code Playgroud)
这是CSS:
passInputBar: {
display: 'flex',
flex: 1,
backgroundColor: 'transparent'
},
textInput: {
fontSize: 16,
color: 'white',
textAlign: 'left',
width: '100%',
flexDirection: 'row',
paddingHorizontal: 10,
borderBottomWidth: 2,
borderBottomColor: '#FCE443',
flex: 1,
paddingTop:Platform.OS === 'ios' ? 7 : 0,
paddingBottom:Platform.OS === 'ios' ? 7 : 0,
marginTop:Platform.OS === 'ios' ? 6 : 0,
marginBottom:Platform.OS === 'ios' ? 6 : 0
}
Run Code Online (Sandbox Code Playgroud)
消除
paddingHorizontal: 10,
Run Code Online (Sandbox Code Playgroud)
从
textInput: {
[...]
}
Run Code Online (Sandbox Code Playgroud)
小智 6
有时有默认参数,删除“paddingHorizontal”是不够的。您应该将其设置为 0。
paddingHorizontal: 0
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11432 次 |
最近记录: |