iOS TextInput - Selection doesn't update when using setNativeProps #34113
Labels
Component: TextInput
Related to the TextInput component.
Needs: Triage 🔍
Platform: iOS
iOS applications.
Description
I have a
TextInput
and a button.Pressing the button calls
appendRandomNumber()
which appends a random number to the TextInput.To prevent re-renders, it uses
setNativeProps
to set theselection
andtext
of theTextInput
.The issue is that the
selection
(cursor) doesn't update and is stuck in one place.Note that this issue is not reproducible on Android.
Screen.Recording.2022-06-30.at.9.53.07.PM.mov
Version
0.69.1, 0.68.2
Output of
npx react-native info
System:
OS: macOS 12.4
CPU: (8) arm64 Apple M1 Pro
Memory: 198.81 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.19.1 - /opt/homebrew/opt/node@14/bin/node
Yarn: Not Found
npm: 6.14.16 - /opt/homebrew/opt/node@14/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.1 => 0.69.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Click here to append a random number
Snack, code example, screenshot, or link to a repository
https://snack.expo.dev/@rushat200/setnativeprops-selection-bug
The text was updated successfully, but these errors were encountered: