Back out "When animating using native driver, trigger rerender on animation completion" (#37820)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37820

Original commit changeset: 185471b28f5f

Original Phabricator Diff: D46574511

Changelog: [internal]

Reviewed By: jehartzog

Differential Revision: D46629553

fbshipit-source-id: 7c8bc7970006643459a3b9c8613009614dcd3886
This commit is contained in:
Genki Kondo
2023-06-12 12:09:45 -07:00
committed by Facebook GitHub Bot
parent c97dcc2de5
commit 48cdc603f5
2 changed files with 1 additions and 24 deletions
@@ -11,11 +11,9 @@
'use strict';
import type {PlatformConfig} from '../AnimatedPlatformConfig';
import type AnimatedNode from '../nodes/AnimatedNode';
import type AnimatedValue from '../nodes/AnimatedValue';
import NativeAnimatedHelper from '../NativeAnimatedHelper';
import AnimatedProps from '../nodes/AnimatedProps';
export type EndResult = {finished: boolean, value?: number, ...};
export type EndCallback = (result: EndResult) => void;
@@ -67,21 +65,6 @@ export default class Animation {
onEnd && onEnd(result);
}
__findAnimatedPropsNode(node: AnimatedNode): ?AnimatedProps {
if (node instanceof AnimatedProps) {
return node;
}
for (const child of node.__getChildren()) {
const result = this.__findAnimatedPropsNode(child);
if (result) {
return result;
}
}
return null;
}
__startNativeAnimation(animatedValue: AnimatedValue): void {
const startNativeAnimationWaitId = `${startNativeAnimationNextId}:startAnimation`;
startNativeAnimationNextId += 1;
@@ -106,10 +89,6 @@ export default class Animation {
if (value != null) {
animatedValue.__onAnimatedValueUpdateReceived(value);
}
// Once the JS side node is synced with the updated values, trigger an
// update on the AnimatedProps node to call any registered callbacks.
this.__findAnimatedPropsNode(animatedValue)?.update();
},
);
} catch (e) {
@@ -66,9 +66,7 @@ export default function useAnimatedProps<TProps: {...}, TInstance>(
// changes), but `setNativeView` already optimizes for that.
node.setNativeView(instance);
// NOTE: When using the JS animation driver, this callback is called on
// every animation frame. When using the native driver, this callback is
// called when the animation completes.
// NOTE: This callback is only used by the JavaScript animation driver.
onUpdateRef.current = () => {
if (
process.env.NODE_ENV === 'test' ||