A framework for building native applications using React
Add selection to TextInput onChange event (native) (#55044)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55044 This change adds `selection` data to the `TextInput.onChange` event for both iOS and Android platforms. NOTE: `selection` only represents the cursor location when returned via `onChange` as this will not be invoked on a pure selection change without text change. We should also add this note to the documentation. ## Why On the web, text input elements provide `selectionStart` and `selectionEnd` properties that are always accessible during input events. React Native's `onChange` event previously included `selection` on iOS (Fabric), but this was removed in PR [#51051](https://github.com/facebook/react-native/pull/51051) to unify with Android (which never had it). This change restores and extends this capability to both platforms, better aligning React Native with web standards. This is also to support pollyfill added in `react-strict-dom`; https://github.com/facebook/react-strict-dom/pull/435/ ## What Changed 1. **iOS/macOS (C++)**: Enable selection in `onChange` event via `TextInputEventEmitter` 2. **Android (Kotlin)**: Added selection data to `ReactTextChangedEvent` Changelog: [General][Added] - TextInput onChange event now includes selection data (cursor location) on iOS and Android Reviewed By: cipolleschi, javache Differential Revision: D90123295 fbshipit-source-id: 988ce4ce737e8b297313ade8bfaa2cbbfc9758cf
A
Alan Lee committed
162627af7c53e27433f39f82c4630baff0695bf1
Parent: 625d702
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 1/6/2026, 8:08:14 PM