@kbach/react 0.1.4 → 0.1.5

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/dist/index.js CHANGED
@@ -115,7 +115,8 @@ function ThemeProvider({
115
115
  return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
116
116
  }
117
117
  if (Appearance) {
118
- return Appearance.getColorScheme() === "dark" ? "dark" : "light";
118
+ const scheme = Appearance.getColorScheme();
119
+ return scheme === "dark" ? "dark" : "light";
119
120
  }
120
121
  return "light";
121
122
  }, []);
@@ -143,6 +144,14 @@ function ThemeProvider({
143
144
  }, [isDark, resolvedMode, resolvedConfig.darkMode]);
144
145
  const setSystemSchemeRef = (0, import_react2.useRef)(setSystemScheme);
145
146
  setSystemSchemeRef.current = setSystemScheme;
147
+ (0, import_react2.useEffect)(() => {
148
+ if (Appearance) {
149
+ const scheme = Appearance.getColorScheme();
150
+ if (scheme != null) {
151
+ setSystemSchemeRef.current(scheme === "dark" ? "dark" : "light");
152
+ }
153
+ }
154
+ }, []);
146
155
  (0, import_react2.useEffect)(() => {
147
156
  if (import_core.isWeb && typeof window !== "undefined") {
148
157
  const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
package/dist/index.mjs CHANGED
@@ -80,7 +80,8 @@ function ThemeProvider({
80
80
  return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
81
81
  }
82
82
  if (Appearance) {
83
- return Appearance.getColorScheme() === "dark" ? "dark" : "light";
83
+ const scheme = Appearance.getColorScheme();
84
+ return scheme === "dark" ? "dark" : "light";
84
85
  }
85
86
  return "light";
86
87
  }, []);
@@ -108,6 +109,14 @@ function ThemeProvider({
108
109
  }, [isDark, resolvedMode, resolvedConfig.darkMode]);
109
110
  const setSystemSchemeRef = useRef(setSystemScheme);
110
111
  setSystemSchemeRef.current = setSystemScheme;
112
+ useEffect(() => {
113
+ if (Appearance) {
114
+ const scheme = Appearance.getColorScheme();
115
+ if (scheme != null) {
116
+ setSystemSchemeRef.current(scheme === "dark" ? "dark" : "light");
117
+ }
118
+ }
119
+ }, []);
111
120
  useEffect(() => {
112
121
  if (isWeb && typeof window !== "undefined") {
113
122
  const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "lint": "tsc --noEmit"
37
37
  },
38
38
  "dependencies": {
39
- "@kbach/core": "0.1.0"
39
+ "@kbach/core": "0.1.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/react": "^19.2.0",