mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Solves the iOS part of https://github.com/facebook/react-native/issues/47186. `onContentSizeChanged` event is sent inside the `updateLayoutMetrics` method every time it's invoked. A change in layout metrics doesn't mean that the content size also changes, like changing the position of the input. This PR adds a condition that the content size must have changed before sending the event. |Before this change|After this change| |-|-| |<video src="https://github.com/user-attachments/assets/743e1502-e13e-474e-b4a6-ef6873bf9619">|<video src="https://github.com/user-attachments/assets/fe3d3ef5-3951-4ba2-b9a1-c41439ab455c">| In the reproducer from the issue, `SafeAreaView` is used, which at first renders its content without any insets until its state is updated with the correct insets. Both of these layouts change the layout metrics of the text input, resulting in two events before this change and a single one after. ## Changelog: [IOS] [FIXED] - Fixed TextInput's `onContentSizeChange` event being dispatched multiple times with the same size Pull Request resolved: https://github.com/facebook/react-native/pull/49695 Test Plan: Tested on the reproducer from the issue Reviewed By: NickGerleman Differential Revision: D70247460 Pulled By: j-piasecki fbshipit-source-id: 8a1e0d0f55b6b3f8a6d0bb176ed50e47e3b51035