react-native TextInput 设置 `paddingVertical: 0` 后, 光标变长?

<TextInput
  style={{
    flex: 1,
    height: 35,
    lineHeight: 35,
    paddingVertical: 0,
  }}
  value={'12345'}
  autoFocus={true}
/>

如果 lineHeightheight 相等, 那么文字会只显示半截

这是因为TextInput 内部有 padding, 参考: https://blog.csdn.net/weixin_...

找到解决方案是取消 padding, 但是会出现新的问题,

TextInput 的光标,在输入文字前和输入文字后长度不一样, 输入文字后 光标会变长

请问如何解决这个问题呢?

阅读 2.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题