Skip to content

Commit

Permalink
Back out "When animating using native driver, trigger rerender on ani…
Browse files Browse the repository at this point in the history
…mation completion" (#37820)

Summary:
Pull Request resolved: #37820

Original commit changeset: 185471b28f5f

Original Phabricator Diff: D46574511

The original diff may have broken several E2E tests:
- https://www.internalfb.com/intern/test/281475053258471/
- https://www.internalfb.com/intern/test/562950042062069/
- https://www.internalfb.com/intern/test/281475065342188/
- https://www.internalfb.com/intern/test/844425018778537/

Errors come from: https://www.internalfb.com/code/fbsource/[79ff1b109432c02b756d4fea6e7a66ff21e34be6]/xplat/js/react-native-github/packages/react-native/Libraries/Animated/useAnimatedProps.js?lines=89

Reviewed By: jehartzog

Differential Revision: D46629553

fbshipit-source-id: b4fac49ef42ce07f6dcf83acb2691b81072f79fb
  • Loading branch information
genkikondo authored and facebook-github-bot committed Jun 12, 2023
1 parent ef5d92f commit 8ddc8dc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
21 changes: 0 additions & 21 deletions packages/react-native/Libraries/Animated/animations/Animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions packages/react-native/Libraries/Animated/useAnimatedProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ||
Expand Down

0 comments on commit 8ddc8dc

Please sign in to comment.