react-native/Libraries/NativeAnimation/Nodes
Janic Duplessis c47759a9ae Fix potential retain cycles in Animated iOS
Summary:
Fixes potential retain cycles detected by an internal fb tool.

```
First:

__NSDictionaryM
-> RCTPropsAnimatedNode
-> _parentNodes -> __NSDictionaryM
-> RCTStyleAnimatedNode
-> _childNodes -> __NSDictionaryM

Second:

RCTScrollView
-> _eventDispatcher -> RCTEventDispatcher
-> _observers -> __NSArrayM
-> RCTNativeAnimatedModule
-> _nodesManager -> RCTNativeAnimatedNodesManager
-> _uiManager -> RCTUIManager
-> _viewRegistry -> __NSDictionaryM
-> RCTScrollView
```

First fix:
Use weak map for parent and child nodes, strong refs are managed by RCTNativeAnimatedNodesManager

Second fix:
Make RCTEventDispatcher observers a weak array and make sure we don't keep strong refs to UIManager in RCTNativeAnimatedNodesManager and RCTPropsAnimatedNode.

Tested that native animations still work in UIExplorer

[IOS] [BUGFIX] [NativeAnimated] - Fix potential retain cycles in Animated iOS
Closes https://github.com/facebook/react-native/pull/16506

Differential Revision: D6126400

Pulled By: shergin

fbshipit-source-id: 1ac5083f8ab79a806305edc23ae4796ed428f78b
2017-10-23 13:20:59 -07:00
..
RCTAdditionAnimatedNode.h Add support for native animations on iOS 2016-06-09 10:43:51 -07:00
RCTAdditionAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTAnimatedNode.h Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTDiffClampAnimatedNode.h Add support for DiffClamp node 2016-09-06 15:43:35 -07:00
RCTDiffClampAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTDivisionAnimatedNode.h Introduced AnimatedDivision 2016-09-26 16:43:51 -07:00
RCTDivisionAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTInterpolationAnimatedNode.h Add support for native animations on iOS 2016-06-09 10:43:51 -07:00
RCTInterpolationAnimatedNode.m Native Animated - Add tests on iOS 2017-03-28 09:16:58 -07:00
RCTModuloAnimatedNode.h Modulo node 2016-08-31 14:43:43 -07:00
RCTModuloAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTMultiplicationAnimatedNode.h Add support for native animations on iOS 2016-06-09 10:43:51 -07:00
RCTMultiplicationAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTPropsAnimatedNode.h Native Animations - Fix edge case with restore default values 2017-05-25 06:18:36 -07:00
RCTPropsAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTStyleAnimatedNode.h Fix NativeAnimation invalidation & races on iOS 2016-11-28 11:13:31 -08:00
RCTStyleAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTTransformAnimatedNode.h Fix NativeAnimation invalidation & races on iOS 2016-11-28 11:13:31 -08:00
RCTTransformAnimatedNode.m Fix potential retain cycles in Animated iOS 2017-10-23 13:20:59 -07:00
RCTValueAnimatedNode.h Move all header imports to "<React/..>" 2016-11-23 07:58:39 -08:00
RCTValueAnimatedNode.m Add extractOffset to Animated 2016-11-07 20:43:37 -08:00