Skip to content

Commit 504cf3e

Browse files
zeyapfacebook-github-bot
authored andcommitted
cleanup TODOs in fantom tests around cxxNativeAnimatedRemoveJsSync (#52949)
Summary: Pull Request resolved: #52949 ## Changelog: [Internal] [Changed] - cleanup TODOs in fantom tests around cxxNativeAnimatedRemoveJsSync Previous attempt to remove js sync so far is working expectedly since #52904 / D79080739 Reviewed By: sammy-SC Differential Revision: D79373130 fbshipit-source-id: e310b9250ba5da2e55435468f46b75977e46f111
1 parent 707a863 commit 504cf3e

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

packages/react-native/Libraries/Animated/__tests__/Animated-itest.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ test('moving box by 100 points', () => {
7777

7878
// Animation is completed now. C++ Animated will commit the final position to the shadow tree.
7979
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
80-
// TODO(T223344928,T232605345): this shouldn't be neccessary once we disable JS sync and Android's race condition.
80+
// TODO(T232605345): this shouldn't be neccessary once we fix Android's race condition.
8181
Fantom.runWorkLoop();
8282
expect(viewElement.getBoundingClientRect().x).toBe(100);
8383
} else {
84-
expect(viewElement.getBoundingClientRect().x).toBe(0);
8584
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
8685
expect(viewElement.getBoundingClientRect().x).toBe(100);
8786
}
@@ -341,19 +340,16 @@ test('moving box by 50 points with offset 10', () => {
341340
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
342341
<rn-view transform='[{"translateX": 60.000000}]' />,
343342
);
344-
// TODO(T223344928): this shouldn't be neccessary
345-
Fantom.runWorkLoop();
346343
} else {
347344
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
348345
<rn-view transform="[]" />,
349346
);
350347
Fantom.runWorkLoop(); // Animated still schedules a React state update for synchronisation to shadow tree
348+
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
349+
<rn-view transform='[{"translateX": 60.000000}]' />, // // must include offset.
350+
);
351351
}
352352

353-
expect(root.getRenderedOutput({props: ['transform']}).toJSX()).toEqual(
354-
<rn-view transform='[{"translateX": 60.000000}]' />, // // must include offset.
355-
);
356-
357353
expect(finishValue?.finished).toBe(true);
358354
expect(finishValue?.value).toBe(50); // must not include offset.
359355
expect(finishValue?.offset).toBe(10);
@@ -440,9 +436,6 @@ describe('Value.flattenOffset', () => {
440436
Fantom.unstable_getDirectManipulationProps(viewElement).transform[0];
441437

442438
expect(transform.translateY).toBeCloseTo(40, 0.001);
443-
444-
// TODO(T223344928): this shouldn't be neccessary with cxxNativeAnimatedRemoveJsSync:true
445-
Fantom.runWorkLoop();
446439
});
447440
});
448441

@@ -539,9 +532,6 @@ describe('Value.extractOffset', () => {
539532
// `extractOffset` resets value back to 0.
540533
// Previously we set offset to 35. The final value is 35.
541534
expect(transform.translateY).toBeCloseTo(35, 0.001);
542-
543-
// TODO(T223344928): this shouldn't be neccessary with cxxNativeAnimatedRemoveJsSync:true
544-
Fantom.runWorkLoop();
545535
});
546536
});
547537

@@ -739,16 +729,21 @@ test('Animated.sequence', () => {
739729

740730
expect(_isSequenceFinished).toBe(false);
741731

742-
expect(element.getBoundingClientRect().y).toBe(-16);
743-
744732
expect(
745733
// $FlowFixMe[incompatible-use]
746734
Fantom.unstable_getDirectManipulationProps(element).transform[0].translateY,
747735
).toBeCloseTo(0, 0.001);
748736

749-
Fantom.runWorkLoop(); // React update to sync end state of 2nd timing animation in sequence
750-
751-
expect(element.getBoundingClientRect().y).toBe(0);
737+
if (ReactNativeFeatureFlags.cxxNativeAnimatedRemoveJsSync()) {
738+
// TODO(T232605345): The following two lines won't be necessary once race condition on Android is fixed
739+
expect(element.getBoundingClientRect().y).toBe(-16);
740+
Fantom.runWorkLoop();
741+
expect(element.getBoundingClientRect().y).toBe(0);
742+
} else {
743+
expect(element.getBoundingClientRect().y).toBe(-16);
744+
Fantom.runWorkLoop(); // React update to sync end state of 2nd timing animation in sequence
745+
expect(element.getBoundingClientRect().y).toBe(0);
746+
}
752747

753748
expect(_isSequenceFinished).toBe(true);
754749
});

0 commit comments

Comments
 (0)