Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/src/commands/OptionsProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AssetService } from '../adapters/AssetResolver';
import { Deprecations } from './Deprecations';
import { CommandName } from '../interfaces/CommandName';
import { OptionsProcessor as Processor } from '../interfaces/Processors';
import { Platform } from 'react-native';
import { DynamicColorIOS, Platform } from 'react-native';

describe('navigation options', () => {
let uut: OptionsProcessor;
Expand Down Expand Up @@ -574,6 +574,17 @@ describe('navigation options', () => {
},
});
});

it('supports DynamicColorIOS', () => {
const options: Options = {
topBar: { background: { color: DynamicColorIOS({ light: 'red', dark: 'blue' }) } },
};

uut.processOptions(options, CommandName.SetRoot);
expect(options).toEqual({
topBar: { background: { color: { dynamic: { light: 0xffff0000, dark: 0xff0000ff } } } },
});
});
});
});

Expand Down
6 changes: 6 additions & 0 deletions lib/src/commands/OptionsProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export class OptionsProcessor {
if ('semantic' in value || 'resource_paths' in value) {
options[key] = value;
return;
} else if ('dynamic' in value) {
for (let keyColor in value.dynamic) {
newColorObj[keyColor] = this.colorService.toNativeColor(value.dynamic[keyColor]);
}

options[key] = newColorObj;
} else {
for (let keyColor in value) {
newColorObj[keyColor] = this.colorService.toNativeColor(value[keyColor]);
Expand Down