Skip to content

Commit 8e5cda2

Browse files
authoredApr 4, 2021
Fix setRoot waitForRender on iOS (wix#7071)
1 parent 2548634 commit 8e5cda2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

‎lib/src/commands/OptionsProcessor.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { AssetService } from '../adapters/AssetResolver';
1313
import { Deprecations } from './Deprecations';
1414
import { CommandName } from '../interfaces/CommandName';
1515
import { OptionsProcessor as Processor } from '../interfaces/Processors';
16+
import { Platform } from 'react-native';
1617

1718
describe('navigation options', () => {
1819
let uut: OptionsProcessor;
@@ -52,7 +53,8 @@ describe('navigation options', () => {
5253
);
5354
});
5455

55-
it('processes old setRoot animation value to new enter exit format', () => {
56+
it('processes old setRoot animation value to new enter exit format on Android', () => {
57+
Platform.OS = 'android';
5658
const options: Options = {
5759
animations: {
5860
setRoot: {
@@ -84,6 +86,7 @@ describe('navigation options', () => {
8486
uut.processOptions(options, CommandName.SetRoot);
8587
expect(options).toEqual(expectedOptions);
8688
});
89+
8790
describe('Modal Animation Options', () => {
8891
describe('Show Modal', () => {
8992
it('processes old options into new options,backwards compatibility ', () => {

‎lib/src/commands/OptionsProcessor.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
import { Deprecations } from './Deprecations';
2626
import { OptionProcessorsStore } from '../processors/OptionProcessorsStore';
2727
import { CommandName } from '../interfaces/CommandName';
28+
import { Platform } from 'react-native';
2829

2930
export class OptionsProcessor {
3031
constructor(
@@ -284,10 +285,12 @@ export class OptionsProcessor {
284285
parentOptions: AnimationOptions
285286
) {
286287
if (key !== 'setRoot') return;
287-
if (!('enter' in animation)) {
288+
if (Platform.OS === 'android' && !('enter' in animation)) {
288289
parentOptions.setRoot = {
289290
enter: animation,
290291
} as EnterExitAnimationOptions;
292+
} else if (Platform.OS === 'ios' && 'enter' in animation) {
293+
parentOptions.setRoot = animation;
291294
}
292295
}
293296

0 commit comments

Comments
 (0)
Failed to load comments.