Skip to content

Commit dfbe0b3

Browse files
fix:types
1 parent 8c61300 commit dfbe0b3

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

packages/react-native/Libraries/Utilities/Appearance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function getColorScheme(): ?ColorSchemeName {
9393
/**
9494
* Updates the current color scheme to the supplied value.
9595
*/
96-
export function setColorScheme(colorScheme: ColorSchemeName): void {
96+
export function setColorScheme(colorScheme: ?ColorSchemeName): void {
9797
const state = getState();
9898
const {NativeAppearance} = state;
9999
if (NativeAppearance != null) {

packages/react-native/ReactNativeApi.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<17837721309e4a2cb00301c72300e386>>
7+
* @generated SignedSource<<e1d8bafd4d8fad8be7d3fed268de55b8>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -4638,7 +4638,9 @@ declare type Separators = {
46384638
updateProps: (select: "leading" | "trailing", newProps: Object) => void
46394639
}
46404640
declare type sequence = typeof sequence
4641-
declare function setColorScheme(colorScheme: ColorSchemeName): void
4641+
declare function setColorScheme(
4642+
colorScheme: ColorSchemeName | null | undefined,
4643+
): void
46424644
declare function setComponentProviderInstrumentationHook(
46434645
hook: ComponentProviderInstrumentationHook,
46444646
): void
@@ -5975,7 +5977,7 @@ export {
59755977
AppState, // 12012be5
59765978
AppStateEvent, // 80f034c3
59775979
AppStateStatus, // 447e5ef2
5978-
Appearance, // a8aaba74
5980+
Appearance, // bec62fb7
59795981
AutoCapitalize, // c0e857a0
59805982
BackHandler, // 0b13c289
59815983
BackPressEventName, // 4620fb76

packages/react-native/src/private/specs_DEPRECATED/modules/NativeAppearance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type AppearancePreferences = {
2020

2121
export interface Spec extends TurboModule {
2222
+getColorScheme: () => ?ColorSchemeName;
23-
+setColorScheme: (colorScheme: ColorSchemeName) => void;
23+
+setColorScheme: (colorScheme: ?ColorSchemeName) => void;
2424

2525
// RCTEventEmitter
2626
+addListener: (eventName: string) => void;

packages/rn-tester/js/examples/Appearance/AppearanceExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const ColorShowcase = (props: {themeName: string}) => (
136136

137137
const ToggleNativeAppearance = () => {
138138
const [nativeColorScheme, setNativeColorScheme] =
139-
useState<ColorSchemeName>('unspecified');
139+
useState<?ColorSchemeName>(null);
140140
const colorScheme = useColorScheme();
141141

142142
useEffect(() => {
@@ -157,7 +157,7 @@ const ToggleNativeAppearance = () => {
157157
/>
158158
<Button
159159
title="Unset"
160-
onPress={() => setNativeColorScheme('unspecified')}
160+
onPress={() => setNativeColorScheme(null)}
161161
/>
162162
</View>
163163
);

0 commit comments

Comments
 (0)