Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

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 的光标,在输入文字前和输入文字后长度不一样, 输入文字后 光标会变长

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...