Skip to content

Commit eb08f54

Browse files
ArturKalachfacebook-github-bot
authored andcommitted
Update RCTTextInputComponentView to recycle and properly clean the inputAccessoryView dependency. (#52825)
Summary: Update `RCTTextInputComponentView` to recycle and properly clean its `inputAccessoryView` dependency. Currently, `RCTTextInputComponentView` does not clean up this dependency during recycling, which can result in the `inputAccessoryView` being incorrectly applied to `TextInput` components that do not use an accessory view." Related issue: #52824 Snack of the issue: https://snack.expo.dev/arturkalach/privileged-blue-soda https://github.com/user-attachments/assets/46a1f172-a75c-4e88-beee-059d4d2e1d0c ## Changelog: [IOS][FIXED] Update recycling logic to clean up the `inputAccessoryView` dependency. <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #52825 Test Plan: ``` 1. Render more than eight TextInput components on the screen, each with an AccessoryView. 2. Unmount the TextInput components using conditional rendering. 3. Open a Modal that contains a KeyboardAvoidingView and a TextInput. 4. Focus on the TextInput inside the Modal. ``` https://github.com/user-attachments/assets/8be1fdef-e8ab-4030-a2c5-e952c22ef743 Reviewed By: christophpurrer Differential Revision: D78966221 Pulled By: cipolleschi fbshipit-source-id: 35b6748cc44c41056051b2eecd626d61c4641cdf
1 parent cda32c3 commit eb08f54

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ - (void)prepareForRecycle
377377
_lastStringStateWasUpdatedWith = nil;
378378
_ignoreNextTextInputCall = NO;
379379
_didMoveToWindow = NO;
380+
_backedTextInputView.inputAccessoryViewID = nil;
381+
_backedTextInputView.inputAccessoryView = nil;
382+
_hasInputAccessoryView = false;
380383
[_backedTextInputView resignFirstResponder];
381384
}
382385

0 commit comments

Comments
 (0)