Var*_*pta 5 react-native react-native-android
我正在TextInput我的本机应用程序中渲染一个高度为100像素的。在Android中,用于输入文本的光标显示在中间,而不是顶部。光标对于iOS来说看起来不错。以下是演示该问题的草图:
https://sketch.expo.io/SJVIk30ig
的TextInput是使用下面的代码呈现:
<TextInput style={{height: 100, padding: 5, backgroundColor: colorThemes.Blue.lightGrey}}
multiline={true}
value={this.state.value}
onChange={this.onTextInputChange}
underlineColorAndroid={'transparent'}
autoCorrect={true} autoFocus={true}
autoCapitalize={'sentences'}
/>
Run Code Online (Sandbox Code Playgroud)
这个问题的重复
设置样式属性textAlignVertical,以top对TextInput
<TextInput style={{height: 100, padding: 5,
backgroundColor: colorThemes.Blue.lightGrey,
textAlignVertical: 'top'}}
multiline={true}
value={this.state.value}
onChange={this.onTextInputChange}
underlineColorAndroid={'transparent'}
autoCorrect={true} autoFocus={true}
autoCapitalize={'sentences'}
/>
Run Code Online (Sandbox Code Playgroud)
Fac*_*cca -1
尝试设置lineHeight加号fontSize以保持框和文本之间的关系。
尝试使用以下样式:
style={{height: 100, lineHeight: 100, fontSize: 100, padding: 5, backgroundColor: 'grey', }}
Run Code Online (Sandbox Code Playgroud)
当然,您需要使用更适合您的尺寸。
让我知道它是否有效。
谢谢
| 归档时间: |
|
| 查看次数: |
5146 次 |
| 最近记录: |