我有一个基本的文本输入,多行设置为true。此外,它还设置了selection
和onSelectionChange
道具,每当onChangeText
发生变化时,光标就会移动到初始位置。
这是视频:https://streamable.com/bchsz4
这里是repro:https://github.com/VivekNeel/IOS_SELECTION_CHANGE这是示例代码:
<TextInput
onChangeText={handleChange}
value={value}
multiline
selection={selection}
onSelectionChange={handleSelection}
placeholder="Enter a text"
style={{marginTop: 100, marginHorizontal: 16}}
/>
只是不使用selection
道具就解决了这个问题!