Animated - Add missing super calls to fix native animated crash

Summary:
There was some missing super.__detach calls in some Animated nodes, we rely on the base class being called to drop the node in the native implementation, not doing so will cause some nodes to leak. It also resulted in a crash when removing certain nodes because they would get updated after being detached.

**Test plan**
Reproduced the crash by unmounting a view that uses a DiffClamp node and made sure this fixes it. Also tested that other native animations still worked properly.

Fixes #11317
Closes https://github.com/facebook/react-native/pull/12910

Differential Revision: D4718188

Pulled By: javache

fbshipit-source-id: 179ec1334532152c124a9c0f447f488311925d0a
This commit is contained in:
Janic Duplessis 2017-03-29 03:59:58 -07:00 коммит произвёл Facebook Github Bot
Родитель 673093eed0
Коммит c233191485
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -1327,6 +1327,7 @@ class AnimatedModulo extends AnimatedWithChildren {
__detach(): void { __detach(): void {
this._a.__removeChild(this); this._a.__removeChild(this);
super.__detach();
} }
__getNativeConfig(): any { __getNativeConfig(): any {
@ -1377,6 +1378,7 @@ class AnimatedDiffClamp extends AnimatedWithChildren {
__detach(): void { __detach(): void {
this._a.__removeChild(this); this._a.__removeChild(this);
super.__detach();
} }
__getNativeConfig(): any { __getNativeConfig(): any {
@ -1460,6 +1462,7 @@ class AnimatedTransform extends AnimatedWithChildren {
} }
} }
}); });
super.__detach();
} }
__getNativeConfig(): any { __getNativeConfig(): any {
@ -1567,6 +1570,7 @@ class AnimatedStyle extends AnimatedWithChildren {
value.__removeChild(this); value.__removeChild(this);
} }
} }
super.__detach();
} }
__makeNative() { __makeNative() {

Просмотреть файл

@ -281,7 +281,7 @@ describe('Native Animated', () => {
); );
expect(nativeAnimatedModule.disconnectAnimatedNodes).toHaveBeenCalledTimes(2); expect(nativeAnimatedModule.disconnectAnimatedNodes).toHaveBeenCalledTimes(2);
expect(nativeAnimatedModule.dropAnimatedNode).toHaveBeenCalledTimes(2); expect(nativeAnimatedModule.dropAnimatedNode).toHaveBeenCalledTimes(3);
}); });
it('sends a valid description for value, style and props nodes', () => { it('sends a valid description for value, style and props nodes', () => {