You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 601fae6
Browse filesBrowse the repository at this point in the historyBrowse files
Send TextInput event props when props diffing is enabled
Summary:
`ReactTextInputManager` only sets up the watchers behind `onKeyPress`, `onSelectionChange`, `onContentSizeChange` and `onScroll` once it receives the matching prop. `AndroidTextInputProps` had no fields for these props, so `getDiffProps` never sent them and the events never fired with props diffing on. `TextInput.js` always passes `onScroll` and `onSelectionChange`, so every TextInput would be affected.
This adds the fields and sends them. JS sends a handler as `true`. Removing a handler sends `false`, which the setters treat the same as the `null` sent by raw props.
TextInput doesn't use props diffing yet: `getDiffPropsImplementationTarget()` returns `TextInput`, which doesn't match the `AndroidTextInput` component name. So the problem above only appears once that is enabled, and this change has no runtime effect until then.
Changelog:
[Internal] - Send TextInput event props when props diffing is enabled
Test Plan:
`AndroidTextInputPropsDiffTest.eventHandlerPropsAreSent` compares the props diffing payload with the raw props payload. It fails without this change and passes with it. `python -m scripts.cxx-api.parser --validate` passes at this commit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.h
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,15 @@ class AndroidTextInputProps final : public BaseTextInputProps {
109
109
std::string fontWeight{};
110
110
std::string fontFamily{};
111
111
112
+
/*
113
+
* Whether JS listens to these events. ReactTextInputManager only sets up the
114
+
* native watchers for them when these props are sent.
115
+
*/
116
+
bool onKeyPress{false};
117
+
bool onSelectionChange{false};
118
+
bool onContentSizeChange{false};
119
+
bool onScroll{false};
120
+
112
121
/**
113
122
* Auxiliary information to detect if these props are set or not.
114
123
* See AndroidTextInputComponentDescriptor for usage.
0 commit comments