You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. A fork and clone of the `react-native-website` repo _(for any contributions)_.
23
23
24
24
### Installation
25
25
26
26
1.`cd react-native-website` to go into the project root.
27
-
1. Run `corepack enable` to enable Corepack.
28
-
29
-
> If the command above fails, run `npm install -g corepack@latest` to install the latest version of [Corepack](https://yarnpkg.com/corepack#installation).
30
-
31
27
1. Run `yarn` to install the website's workspace dependencies.
32
-
> If you want to retain the globally installed `yarn` classic, you can use `corepack yarn` instead.
Copy file name to clipboardExpand all lines: docs/_experimental-api-warning.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
:::importantExperimental 🧪
1
+
:::important[Experimental 🧪]
2
2
3
3
**This API is experimental.** Experimental APIs may contain bugs and are likely to change in a future version of React Native. Don't use them in production.
Copy file name to clipboardExpand all lines: docs/appearance.md
+36-22Lines changed: 36 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import con
9
9
import {Appearance} from'react-native';
10
10
```
11
11
12
-
The `Appearance` module exposes information about the user's appearance preferences, such as their preferred color scheme (light or dark).
12
+
The `Appearance` module exposes information about the user's appearance preferences, such as their preferred system color scheme (light or dark).
13
13
14
14
#### Developer notes
15
15
@@ -53,7 +53,26 @@ if (colorScheme === 'dark') {
53
53
}
54
54
```
55
55
56
-
Although the color scheme is available immediately, this may change (e.g. scheduled color scheme change at sunrise or sunset). Any rendering logic or styles that depend on the user preferred color scheme should try to call this function on every render, rather than caching the value. For example, you may use the [`useColorScheme`](usecolorscheme) React hook as it provides and subscribes to color scheme updates, or you may use inline styles rather than setting a value in a `StyleSheet`.
56
+
Although the color scheme is available immediately, this may change when not overridden via `setColorScheme()` (e.g. scheduled color scheme change at sunrise or sunset). Any rendering logic or styles that depend on the user preferred color scheme should try to call this function on every render, rather than caching the value.
57
+
58
+
**Recommended:** Use the [`useColorScheme`](usecolorscheme) hook.
59
+
60
+
### App-level overriding
61
+
62
+
`setColorScheme()` overrides the color scheme at the application level — it does not affect the system setting or other applications. Passing `'auto'` removes any override, restoring the system preference.
classDef out fill:#f0f4f8,stroke:#8faabb,color:#1a1a1a
73
+
class USC,GCS fn
74
+
class OVR,SYS out
75
+
```
57
76
58
77
---
59
78
@@ -67,39 +86,34 @@ Although the color scheme is available immediately, this may change (e.g. schedu
67
86
staticgetColorScheme(): 'light'|'dark'|null;
68
87
```
69
88
70
-
Indicates the current user preferred color scheme. The value may be updated later, either through direct user action (e.g. theme selection in device settings or application-level selected user interface style via `setColorScheme`) or on a schedule (e.g. light and dark themes that follow the day/night cycle).
89
+
Returns the active color scheme. This value may change at runtime, either at the system level (e.g. scheduled color scheme change at sunrise or sunset) or when overridden at the app level via `setColorScheme()`.
71
90
72
-
Supported color schemes:
91
+
Return values:
73
92
74
-
-`'light'`: The user prefers a light color theme.
75
-
-`'dark'`: The user prefers a dark color theme.
76
-
-`null`: The user has not indicated a preferred color theme.
93
+
-`'light'`: The light color scheme is applied.
94
+
-`'dark'`: The dark color scheme is applied.
95
+
-`null`: May be returned if the native Appearance module is not available.
77
96
78
-
See also: `useColorScheme` hook.
79
-
80
-
:::note
81
-
`getColorScheme()` will always return `light` when debugging with Chrome.
82
-
:::
97
+
See also: [`useColorScheme`](usecolorscheme) (hook).
Force the application to always adopt a light or dark interface style. The default value is `null` which causes the application to inherit the system's interface style. If you assign a different value, the new style applies to the application and all native elements within the application (Alerts, Pickers etc).
107
+
Forces the application to always adopt a light or dark interface style. The change applies to the application and all native elements within it (Alerts, Pickers, etc.).
93
108
94
-
Supported color schemes:
109
+
This is an app-level override — it does not affect the system's selected interface style or any style set in other applications.
95
110
96
-
-`light`: Apply light user interface style.
97
-
-`dark`: Apply dark user interface style.
98
-
- null: Follow the system's interface style.
111
+
Supported values:
99
112
100
-
:::note
101
-
The change will not affect the system's selected interface style or any style set in other applications.
102
-
:::
113
+
-`'light'`: Apply light color scheme.
114
+
-`'dark'`: Apply dark color scheme.
115
+
-`'auto'`: Follow the system color scheme (removes any override).
116
+
-`'unspecified'` (**deprecated**): Follow the system color scheme (removes any override).
103
117
104
118
---
105
119
@@ -111,4 +125,4 @@ static addChangeListener(
111
125
): NativeEventSubscription;
112
126
```
113
127
114
-
Add an event handler that is fired when appearance preferences change.
128
+
Add an event handler that is fired when appearance preferences change. On iOS and Android, the `colorScheme` value in the callback is always `'light'` or `'dark'`.
Copy file name to clipboardExpand all lines: docs/appstate.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ AppState is frequently used to determine the intent and proper behavior when han
13
13
-`background` - The app is running in the background. The user is either:
14
14
- in another app
15
15
- on the home screen
16
-
-[Android] on another `Activity` (even if it was launched by your app)
16
+
-[Android] on another `Activity`, including temporary system activities such
17
+
as autofill credential pickers (even if launched by your app or the system)
17
18
-[iOS]`inactive` - This is a state that occurs when transitioning between foreground & background, and during periods of inactivity such as entering the multitasking view, opening the Notification Center or in the event of an incoming call.
18
19
19
20
For more information, see [Apple's documentation](https://developer.apple.com/documentation/uikit/app_and_scenes/managing_your_app_s_life_cycle)
0 commit comments