@kbach/native 0.2.3 → 0.2.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.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +18 -0
- package/dist/index.mjs +17 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { ThemeProviderProps } from '@kbach/react';
|
|
1
2
|
export * from '@kbach/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Native-aware ThemeProvider. Wraps the base ThemeProvider and automatically
|
|
7
|
+
* passes the system color scheme from React Native's useColorScheme() hook.
|
|
8
|
+
*
|
|
9
|
+
* This fixes Android startup dark mode detection: Appearance.getColorScheme()
|
|
10
|
+
* can cache null if the device was already dark at launch (the appearanceChanged
|
|
11
|
+
* event only fires on *changes*). useColorScheme() called here with a proper
|
|
12
|
+
* hook name ensures the React Compiler and all linters handle it correctly, and
|
|
13
|
+
* useSyncExternalStore inside the hook properly subscribes to Appearance events.
|
|
14
|
+
*
|
|
15
|
+
* Exported as `ThemeProvider` from @kbach/native — no API change for users.
|
|
16
|
+
*/
|
|
17
|
+
declare function NativeThemeProvider(props: ThemeProviderProps): React.JSX.Element;
|
|
2
18
|
|
|
3
19
|
/**
|
|
4
20
|
* Metro and Babel setup helpers for React Native / Expo projects.
|
|
@@ -73,4 +89,4 @@ declare function withKbachBabel(babelConfig: Record<string, any>, options?: Kbac
|
|
|
73
89
|
*/
|
|
74
90
|
declare function createKbachConfig(options?: KbachOptions): Record<string, unknown>;
|
|
75
91
|
|
|
76
|
-
export { type KbachOptions, createKbachConfig, withKbach, withKbachBabel };
|
|
92
|
+
export { type KbachOptions, NativeThemeProvider as ThemeProvider, createKbachConfig, withKbach, withKbachBabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
import { ThemeProviderProps } from '@kbach/react';
|
|
1
2
|
export * from '@kbach/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Native-aware ThemeProvider. Wraps the base ThemeProvider and automatically
|
|
7
|
+
* passes the system color scheme from React Native's useColorScheme() hook.
|
|
8
|
+
*
|
|
9
|
+
* This fixes Android startup dark mode detection: Appearance.getColorScheme()
|
|
10
|
+
* can cache null if the device was already dark at launch (the appearanceChanged
|
|
11
|
+
* event only fires on *changes*). useColorScheme() called here with a proper
|
|
12
|
+
* hook name ensures the React Compiler and all linters handle it correctly, and
|
|
13
|
+
* useSyncExternalStore inside the hook properly subscribes to Appearance events.
|
|
14
|
+
*
|
|
15
|
+
* Exported as `ThemeProvider` from @kbach/native — no API change for users.
|
|
16
|
+
*/
|
|
17
|
+
declare function NativeThemeProvider(props: ThemeProviderProps): React.JSX.Element;
|
|
2
18
|
|
|
3
19
|
/**
|
|
4
20
|
* Metro and Babel setup helpers for React Native / Expo projects.
|
|
@@ -73,4 +89,4 @@ declare function withKbachBabel(babelConfig: Record<string, any>, options?: Kbac
|
|
|
73
89
|
*/
|
|
74
90
|
declare function createKbachConfig(options?: KbachOptions): Record<string, unknown>;
|
|
75
91
|
|
|
76
|
-
export { type KbachOptions, createKbachConfig, withKbach, withKbachBabel };
|
|
92
|
+
export { type KbachOptions, NativeThemeProvider as ThemeProvider, createKbachConfig, withKbach, withKbachBabel };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var index_exports = {};
|
|
23
23
|
__export(index_exports, {
|
|
24
|
+
ThemeProvider: () => NativeThemeProvider,
|
|
24
25
|
createKbachConfig: () => createKbachConfig,
|
|
25
26
|
withKbach: () => withKbach,
|
|
26
27
|
withKbachBabel: () => withKbachBabel
|
|
@@ -28,6 +29,22 @@ __export(index_exports, {
|
|
|
28
29
|
module.exports = __toCommonJS(index_exports);
|
|
29
30
|
__reExport(index_exports, require("@kbach/react"), module.exports);
|
|
30
31
|
|
|
32
|
+
// src/NativeThemeProvider.tsx
|
|
33
|
+
var import_react_native = require("react-native");
|
|
34
|
+
var import_react = require("@kbach/react");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
function NativeThemeProvider(props) {
|
|
37
|
+
const raw = (0, import_react_native.useColorScheme)();
|
|
38
|
+
const systemColorScheme = raw === "dark" ? "dark" : raw === "light" ? "light" : null;
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
import_react.ThemeProvider,
|
|
41
|
+
{
|
|
42
|
+
...props,
|
|
43
|
+
colorScheme: props.colorScheme ?? systemColorScheme
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
31
48
|
// src/setup.ts
|
|
32
49
|
function withKbach(metroConfig, _options = {}) {
|
|
33
50
|
return metroConfig;
|
|
@@ -64,6 +81,7 @@ function createKbachConfig(options = {}) {
|
|
|
64
81
|
}
|
|
65
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
83
|
0 && (module.exports = {
|
|
84
|
+
ThemeProvider,
|
|
67
85
|
createKbachConfig,
|
|
68
86
|
withKbach,
|
|
69
87
|
withKbachBabel,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
export * from "@kbach/react";
|
|
3
3
|
|
|
4
|
+
// src/NativeThemeProvider.tsx
|
|
5
|
+
import { useColorScheme } from "react-native";
|
|
6
|
+
import { ThemeProvider } from "@kbach/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function NativeThemeProvider(props) {
|
|
9
|
+
const raw = useColorScheme();
|
|
10
|
+
const systemColorScheme = raw === "dark" ? "dark" : raw === "light" ? "light" : null;
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
ThemeProvider,
|
|
13
|
+
{
|
|
14
|
+
...props,
|
|
15
|
+
colorScheme: props.colorScheme ?? systemColorScheme
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
// src/setup.ts
|
|
5
21
|
function withKbach(metroConfig, _options = {}) {
|
|
6
22
|
return metroConfig;
|
|
@@ -36,6 +52,7 @@ function createKbachConfig(options = {}) {
|
|
|
36
52
|
};
|
|
37
53
|
}
|
|
38
54
|
export {
|
|
55
|
+
NativeThemeProvider as ThemeProvider,
|
|
39
56
|
createKbachConfig,
|
|
40
57
|
withKbach,
|
|
41
58
|
withKbachBabel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Single-package Kbach install for React Native and Expo — includes core, components, Babel plugin, and Metro config",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"lint": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@kbach/react": "0.2.
|
|
38
|
+
"@kbach/react": "0.2.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^19.2.0",
|