mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Backout "Scheduling Animated End Callbacks in Microtask" (#48132)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48132 Backs out D63573322 and D65645981, reverting the change that makes callbacks passed to `animation.start(<callback>)` scheduled for execution in a microtask. This is being reverted becuase the latency introduced by the current macro and pending micro tasks can introduce visible latency artifacts that diminish the fidelity of animations. Changelog: [General][Changed] - Reverts #47503. (~~Callbacks passed to `animation.start(<callback>)` will be scheduled for execution in a microtask. Previously, there were certain scenarios in which the callback could be synchronously executed by `start`.~~) Reviewed By: javache Differential Revision: D66852804 fbshipit-source-id: 08434b9876813fe9e8b189b6b467198933843bf0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f15fe4b8a1
commit
8793b7d89b
@@ -121,12 +121,10 @@ describe('Animated', () => {
|
||||
|
||||
await unmount(root);
|
||||
|
||||
expect(callback).not.toBeCalled();
|
||||
await jest.runOnlyPendingTimersAsync();
|
||||
expect(callback).toBeCalledWith({finished: false});
|
||||
});
|
||||
|
||||
it('triggers callback when spring is at rest', async () => {
|
||||
it('triggers callback when spring is at rest', () => {
|
||||
const anim = new Animated.Value(0);
|
||||
const callback = jest.fn();
|
||||
Animated.spring(anim, {
|
||||
@@ -134,10 +132,7 @@ describe('Animated', () => {
|
||||
velocity: 0,
|
||||
useNativeDriver: false,
|
||||
}).start(callback);
|
||||
|
||||
expect(callback).not.toBeCalled();
|
||||
await jest.runOnlyPendingTimersAsync();
|
||||
expect(callback).toBeCalledWith({finished: true});
|
||||
expect(callback).toBeCalled();
|
||||
});
|
||||
|
||||
it('send toValue when a critically damped spring stops', () => {
|
||||
|
||||
@@ -170,7 +170,7 @@ export default class Animation {
|
||||
const callback = this.#onEnd;
|
||||
if (callback != null) {
|
||||
this.#onEnd = null;
|
||||
queueMicrotask(() => callback(result));
|
||||
callback(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user