Skip to content

Commit

Permalink
Make RN ColorScheme a Union (facebook#46872)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#46872

This can now be flow typed as a union because the codegen supports it.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D63681874

fbshipit-source-id: 97783df5ae71292dd10602dee0bea39743e62234
  • Loading branch information
elicwhite authored and facebook-github-bot committed Oct 10, 2024
1 parent b0e2cb3 commit ff698f5
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,15 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

export type ColorSchemeName = 'light' | 'dark';
export type ColorSchemeName = 'light' | 'dark' | 'unspecified';

export type AppearancePreferences = {
// TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
// types.
/* 'light' | 'dark' */
colorScheme?: ?string,
colorScheme?: ?ColorSchemeName,
};

export interface Spec extends TurboModule {
// TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
// types.
/* 'light' | 'dark' */
+getColorScheme: () => ?string;
+setColorScheme: (colorScheme: string) => void;
+getColorScheme: () => ?ColorSchemeName;
+setColorScheme: (colorScheme: ColorSchemeName) => void;

// RCTEventEmitter
+addListener: (eventName: string) => void;
Expand Down

0 comments on commit ff698f5

Please sign in to comment.