gpt4 book ai didi

ios - 文本输入垂直对齐

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:03:13 24 4
gpt4 key购买 nike

有人知道如何使用自定义字体(内容和占位符)修复 TextInput 的垂直对齐吗?我尝试了所有这些:

  • justifyContent: ‘中心’,
  • alignItems: ‘居中’,
  • textAlign: ‘居中’,
  • textAlignVertical: ‘居中’,

没有任何作用!有什么建议吗?

enter image description here

           <TextInput
ref={ref => this.emailField = ref}
placeholder="E-Mail"
style={styles.loginInput}
placeholderStyle={styles.loginInput}
editable={true}
maxLength={40}
autoCorrect={false}
selectionColor="#9D9D9D"
placeholderTextColor="#9D9D9D"
autoCapitalize="none"
keyboardType="email-address"
returnKeyType="next"
keyboardAppearance="dark"
textAlign="center"
underlineColorAndroid="transparent"
onSubmitEditing={() => this.passwordField.focus()}
value={this.state.email}
onChangeText={(text) => this.setState({ email: text })}
/>

loginInput: {
width: '70%',
height: 40,
marginBottom: 8,
backgroundColor: '#dbdbdb',
fontFamily: 'Neuzeit Grotesk Regular',
fontSize: 18,
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
textAlignVertical: 'center',
},

最佳答案

我遇到了同样的问题。 TextInput 有一个默认的填充,就我而言。我在 TextInput 样式中添加了 paddingTop: 0paddingBottom: 0

关于ios - 文本输入垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50064386/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com