react-native-macos/Libraries/NativeAnimation
Janic Duplessis 686ab49107 Don't restore default values when components unmount (#26978)
Summary:
There are some cases where restoring default values on component unmount is not desirable. For example in react-native-screens we want to keep the native view displayed after react has unmounted them. Restoring default values causes an issue there because it will change props controlled my native animated back to their default value instead of keeping whatever value they had been animated to.

Restoring default values is only needed for updates anyway, where removing a prop controlled by native animated need to be reset to its default value since react no longer tracks its value.

This splits restoring default values and disconnecting from views in 2 separate native methods, this way we can restore default values only on component update and not on unmount. This takes care of being backwards compatible for JS running with the older native code.

## Changelog

[General] [Fixed] - NativeAnimated - Don't restore default values when components unmount
Pull Request resolved: https://github.com/facebook/react-native/pull/26978

Test Plan:
- Tested in an app using react-native-screens to make sure native views that are kept after their underlying component has been unmount don't change. Also tested in RNTester animated example.

- Tested that new JS works with old native code

Reviewed By: mmmulani

Differential Revision: D18197735

Pulled By: JoshuaGross

fbshipit-source-id: 20fa0f31a3edf1bc57ccb03df9d1486aba83edc4
2019-11-04 15:40:09 -08:00
..
Drivers Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
Nodes Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTAnimationPlugins.h Run depslint on fb_plugin_apple_library rules 2019-10-26 13:47:15 -07:00
RCTAnimationPlugins.mm Make RCTNativeAnimatedModule TurboModule-compatible 2019-10-16 19:00:26 -07:00
RCTAnimationUtils.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTAnimationUtils.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTNativeAnimatedModule.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTNativeAnimatedModule.mm Don't restore default values when components unmount (#26978) 2019-11-04 15:40:09 -08:00
RCTNativeAnimatedNodesManager.h Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
RCTNativeAnimatedNodesManager.m Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
React-RCTAnimation.podspec Fix podspecs 2019-11-01 19:34:46 -07:00