mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7cf4cf3afb
Summary: Normally when a `ref` prop supplied to a component is changed, the old `ref` receives `null` and the new `ref` receives the active component instance. However, the current implementation of `ScrollView` has a bug where this does not happen (i.e. changing `ref` or `innerViewRef` does not cause either the old or new refs to be updated). This bug is due to a subtle issue with how `ScrollView` internally memoizes the `ref` (or `innerViewRef`) that is passed into the native component. This commit fixes this behavior so that `ScrollView`'s `ref` and `innerViewRef` have the correct behavior. Changelog: [General][Fixed] When a ScrollView's `ref` or `innnerViewRef` changes, the old ref will now be invoked with `null` and the new ref with the active instance. (Previously, changing `ref` or `innerViewRef` on a `ScrollView` would be treated as though the ref had not changed at all.) Reviewed By: sammy-SC Differential Revision: D41208895 fbshipit-source-id: b465f666076edbef410cdf9661e040e1d8fa0404