@oxyhq/bloom 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/theme/set-color-scheme-safe.js +9 -0
- package/lib/commonjs/theme/set-color-scheme-safe.js.map +1 -1
- package/lib/module/theme/set-color-scheme-safe.js +10 -1
- package/lib/module/theme/set-color-scheme-safe.js.map +1 -1
- package/lib/typescript/commonjs/theme/set-color-scheme-safe.d.ts +6 -0
- package/lib/typescript/commonjs/theme/set-color-scheme-safe.d.ts.map +1 -1
- package/lib/typescript/module/theme/set-color-scheme-safe.d.ts +6 -0
- package/lib/typescript/module/theme/set-color-scheme-safe.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/theme/set-color-scheme-safe.ts +10 -1
|
@@ -10,8 +10,17 @@ var _reactNative = require("react-native");
|
|
|
10
10
|
* On Android (RN 0.83+), Appearance.setColorScheme has a Kotlin non-null
|
|
11
11
|
* annotation on `style`. Passing null for 'system' crashes.
|
|
12
12
|
* Workaround: resolve the system preference and pass 'light'/'dark' instead.
|
|
13
|
+
*
|
|
14
|
+
* On react-native-web, Appearance.setColorScheme is not implemented at all
|
|
15
|
+
* (it's `undefined`), which crashes with "setColorScheme is not a function".
|
|
16
|
+
* Appearance.getColorScheme() still works on web, so reading the system
|
|
17
|
+
* preference is fine — it's only the setter that's missing. The browser /
|
|
18
|
+
* electron controls the color scheme anyway, so we just bail out on web.
|
|
13
19
|
*/
|
|
14
20
|
function setColorSchemeSafe(mode) {
|
|
21
|
+
if (_reactNative.Platform.OS === 'web') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
15
24
|
const effectiveMode = mode === 'adaptive' ? 'system' : mode;
|
|
16
25
|
if (effectiveMode === 'system') {
|
|
17
26
|
const resolved = _reactNative.Appearance.getColorScheme() ?? 'light';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","setColorSchemeSafe","mode","effectiveMode","resolved","Appearance","getColorScheme","setColorScheme"],"sourceRoot":"../../../src","sources":["theme/set-color-scheme-safe.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","setColorSchemeSafe","mode","Platform","OS","effectiveMode","resolved","Appearance","getColorScheme","setColorScheme"],"sourceRoot":"../../../src","sources":["theme/set-color-scheme-safe.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAACC,IAAe,EAAE;EAClD,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB;EACF;EAEA,MAAMC,aAAa,GAAGH,IAAI,KAAK,UAAU,GAAG,QAAQ,GAAGA,IAAI;EAC3D,IAAIG,aAAa,KAAK,QAAQ,EAAE;IAC9B,MAAMC,QAAQ,GAAGC,uBAAU,CAACC,cAAc,CAAC,CAAC,IAAI,OAAO;IACvDD,uBAAU,CAACE,cAAc,CAACH,QAAQ,CAAC;EACrC,CAAC,MAAM;IACLC,uBAAU,CAACE,cAAc,CAACJ,aAAa,CAAC;EAC1C;AACF","ignoreList":[]}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Appearance } from 'react-native';
|
|
3
|
+
import { Appearance, Platform } from 'react-native';
|
|
4
4
|
/**
|
|
5
5
|
* Safely set the color scheme via Appearance API.
|
|
6
6
|
* On Android (RN 0.83+), Appearance.setColorScheme has a Kotlin non-null
|
|
7
7
|
* annotation on `style`. Passing null for 'system' crashes.
|
|
8
8
|
* Workaround: resolve the system preference and pass 'light'/'dark' instead.
|
|
9
|
+
*
|
|
10
|
+
* On react-native-web, Appearance.setColorScheme is not implemented at all
|
|
11
|
+
* (it's `undefined`), which crashes with "setColorScheme is not a function".
|
|
12
|
+
* Appearance.getColorScheme() still works on web, so reading the system
|
|
13
|
+
* preference is fine — it's only the setter that's missing. The browser /
|
|
14
|
+
* electron controls the color scheme anyway, so we just bail out on web.
|
|
9
15
|
*/
|
|
10
16
|
export function setColorSchemeSafe(mode) {
|
|
17
|
+
if (Platform.OS === 'web') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
11
20
|
const effectiveMode = mode === 'adaptive' ? 'system' : mode;
|
|
12
21
|
if (effectiveMode === 'system') {
|
|
13
22
|
const resolved = Appearance.getColorScheme() ?? 'light';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Appearance","setColorSchemeSafe","mode","effectiveMode","resolved","getColorScheme","setColorScheme"],"sourceRoot":"../../../src","sources":["theme/set-color-scheme-safe.ts"],"mappings":";;AAAA,SAASA,UAAU,
|
|
1
|
+
{"version":3,"names":["Appearance","Platform","setColorSchemeSafe","mode","OS","effectiveMode","resolved","getColorScheme","setColorScheme"],"sourceRoot":"../../../src","sources":["theme/set-color-scheme-safe.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,IAAe,EAAE;EAClD,IAAIF,QAAQ,CAACG,EAAE,KAAK,KAAK,EAAE;IACzB;EACF;EAEA,MAAMC,aAAa,GAAGF,IAAI,KAAK,UAAU,GAAG,QAAQ,GAAGA,IAAI;EAC3D,IAAIE,aAAa,KAAK,QAAQ,EAAE;IAC9B,MAAMC,QAAQ,GAAGN,UAAU,CAACO,cAAc,CAAC,CAAC,IAAI,OAAO;IACvDP,UAAU,CAACQ,cAAc,CAACF,QAAQ,CAAC;EACrC,CAAC,MAAM;IACLN,UAAU,CAACQ,cAAc,CAACH,aAAa,CAAC;EAC1C;AACF","ignoreList":[]}
|
|
@@ -4,6 +4,12 @@ import type { ThemeMode } from './types';
|
|
|
4
4
|
* On Android (RN 0.83+), Appearance.setColorScheme has a Kotlin non-null
|
|
5
5
|
* annotation on `style`. Passing null for 'system' crashes.
|
|
6
6
|
* Workaround: resolve the system preference and pass 'light'/'dark' instead.
|
|
7
|
+
*
|
|
8
|
+
* On react-native-web, Appearance.setColorScheme is not implemented at all
|
|
9
|
+
* (it's `undefined`), which crashes with "setColorScheme is not a function".
|
|
10
|
+
* Appearance.getColorScheme() still works on web, so reading the system
|
|
11
|
+
* preference is fine — it's only the setter that's missing. The browser /
|
|
12
|
+
* electron controls the color scheme anyway, so we just bail out on web.
|
|
7
13
|
*/
|
|
8
14
|
export declare function setColorSchemeSafe(mode: ThemeMode): void;
|
|
9
15
|
//# sourceMappingURL=set-color-scheme-safe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-color-scheme-safe.d.ts","sourceRoot":"","sources":["../../../../src/theme/set-color-scheme-safe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-color-scheme-safe.d.ts","sourceRoot":"","sources":["../../../../src/theme/set-color-scheme-safe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,QAYjD"}
|
|
@@ -4,6 +4,12 @@ import type { ThemeMode } from './types';
|
|
|
4
4
|
* On Android (RN 0.83+), Appearance.setColorScheme has a Kotlin non-null
|
|
5
5
|
* annotation on `style`. Passing null for 'system' crashes.
|
|
6
6
|
* Workaround: resolve the system preference and pass 'light'/'dark' instead.
|
|
7
|
+
*
|
|
8
|
+
* On react-native-web, Appearance.setColorScheme is not implemented at all
|
|
9
|
+
* (it's `undefined`), which crashes with "setColorScheme is not a function".
|
|
10
|
+
* Appearance.getColorScheme() still works on web, so reading the system
|
|
11
|
+
* preference is fine — it's only the setter that's missing. The browser /
|
|
12
|
+
* electron controls the color scheme anyway, so we just bail out on web.
|
|
7
13
|
*/
|
|
8
14
|
export declare function setColorSchemeSafe(mode: ThemeMode): void;
|
|
9
15
|
//# sourceMappingURL=set-color-scheme-safe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-color-scheme-safe.d.ts","sourceRoot":"","sources":["../../../../src/theme/set-color-scheme-safe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-color-scheme-safe.d.ts","sourceRoot":"","sources":["../../../../src/theme/set-color-scheme-safe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,QAYjD"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Appearance, Platform } from 'react-native';
|
|
2
|
-
import type { ColorSchemeName } from 'react-native';
|
|
3
2
|
import type { ThemeMode } from './types';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -7,8 +6,18 @@ import type { ThemeMode } from './types';
|
|
|
7
6
|
* On Android (RN 0.83+), Appearance.setColorScheme has a Kotlin non-null
|
|
8
7
|
* annotation on `style`. Passing null for 'system' crashes.
|
|
9
8
|
* Workaround: resolve the system preference and pass 'light'/'dark' instead.
|
|
9
|
+
*
|
|
10
|
+
* On react-native-web, Appearance.setColorScheme is not implemented at all
|
|
11
|
+
* (it's `undefined`), which crashes with "setColorScheme is not a function".
|
|
12
|
+
* Appearance.getColorScheme() still works on web, so reading the system
|
|
13
|
+
* preference is fine — it's only the setter that's missing. The browser /
|
|
14
|
+
* electron controls the color scheme anyway, so we just bail out on web.
|
|
10
15
|
*/
|
|
11
16
|
export function setColorSchemeSafe(mode: ThemeMode) {
|
|
17
|
+
if (Platform.OS === 'web') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
const effectiveMode = mode === 'adaptive' ? 'system' : mode;
|
|
13
22
|
if (effectiveMode === 'system') {
|
|
14
23
|
const resolved = Appearance.getColorScheme() ?? 'light';
|