@kbach/react-native 1.0.0-beta.0 → 1.0.0-beta.2
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/README.md +69 -6
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -6,12 +6,75 @@ resolved to a real `StyleSheet`-ready style object instead of injected CSS.
|
|
|
6
6
|
|
|
7
7
|
> **Beta, Android-only.** Resolution runs through a Kotlin/JNI TurboModule
|
|
8
8
|
> calling the same Rust core `@kbach/react` uses, so class semantics stay
|
|
9
|
-
> identical across web and native
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
> identical across web and native. The native module ships prebuilt (see
|
|
10
|
+
> Setup below) — no Rust toolchain or manual native wiring required — but
|
|
11
|
+
> there's no iOS bridge yet.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @kbach/react-native
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
That pulls in [`@kbach/android`](https://www.npmjs.com/package/@kbach/android)
|
|
20
|
+
too — the actual native module — as a real dependency. Android's
|
|
21
|
+
autolinking discovers it automatically the moment it's in `node_modules`;
|
|
22
|
+
no manual `MainApplication.kt` edit needed. Works the same way whether
|
|
23
|
+
your app was created with the React Native CLI or with Expo — **except
|
|
24
|
+
Expo Go**, which can never load this (or any) custom native module; see
|
|
25
|
+
below.
|
|
26
|
+
|
|
27
|
+
### React Native CLI
|
|
28
|
+
|
|
29
|
+
Add the Babel plugin so your app's JSX routes through Kbach's JSX runtime
|
|
30
|
+
instead of `react/jsx-runtime`:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// babel.config.js
|
|
34
|
+
module.exports = {
|
|
35
|
+
presets: ['module:@react-native/babel-preset'],
|
|
36
|
+
plugins: ['@kbach/react-native/babel-plugin'],
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then rebuild the Android app (`npm run android`, or a clean Gradle build if
|
|
41
|
+
you're re-running one that's already built) so Gradle picks up the new
|
|
42
|
+
native module. See `apps/native-sandbox` in the
|
|
43
|
+
[repo](https://github.com/semsakadanupol/kbach) for a full working
|
|
44
|
+
reference project, including the Metro config a monorepo setup like this
|
|
45
|
+
one needs (a plain single-app install doesn't need any of that — it's
|
|
46
|
+
only relevant if you're linking packages locally instead of installing
|
|
47
|
+
from npm).
|
|
48
|
+
|
|
49
|
+
### Expo
|
|
50
|
+
|
|
51
|
+
**Expo Go doesn't work** — it's a fixed pre-built binary with no way to
|
|
52
|
+
load a custom native module like `@kbach/android`. You need a **dev
|
|
53
|
+
client** instead (a custom build of your app with this module baked in) —
|
|
54
|
+
functionally the same "real native project" setup as the CLI path above,
|
|
55
|
+
just generated and driven through Expo's own tooling:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
// babel.config.js
|
|
59
|
+
module.exports = {
|
|
60
|
+
presets: ['babel-preset-expo'], // not '@react-native/babel-preset'
|
|
61
|
+
plugins: ['@kbach/react-native/babel-plugin'],
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
npx expo prebuild # generates android/ (and ios/, which this package doesn't support yet)
|
|
67
|
+
npx expo run:android # builds and installs a dev client with the native module included
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Also requires the New Architecture enabled (Expo's default in current SDK
|
|
71
|
+
versions) — `@kbach/android` is a TurboModule, which doesn't exist under
|
|
72
|
+
the legacy bridge at all. If you're on an older SDK/config with the New
|
|
73
|
+
Architecture off, turn it on in `app.json`
|
|
74
|
+
(`"newArchEnabled": true` under `expo`) before prebuilding.
|
|
75
|
+
|
|
76
|
+
EAS Build works the same way — it runs the same `prebuild` step, so no
|
|
77
|
+
extra configuration beyond the two steps above.
|
|
15
78
|
|
|
16
79
|
## What this is
|
|
17
80
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbach/react-native",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "Kbach's utility-class styling engine for React Native — the same class names as @kbach/react, resolved to a StyleSheet-ready style object via a Kotlin/JNI TurboModule. Beta, Android-only.",
|
|
5
|
-
"keywords": ["css", "react-native", "tailwind", "utility-first", "styling", "android"],
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "Kbach's utility-class styling engine for React Native — the same class names as @kbach/react, resolved to a StyleSheet-ready style object via a Kotlin/JNI TurboModule. Beta, Android-only. Works with the React Native CLI or an Expo dev client (not Expo Go).",
|
|
5
|
+
"keywords": ["css", "react-native", "expo", "tailwind", "utility-first", "styling", "android"],
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "semsakadanupol",
|
|
8
8
|
"repository": {
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
"lint": "tsc --noEmit",
|
|
51
51
|
"generate:colors": "node ../core-engine/scripts/generate-palette.mjs src/generatedPalette.ts"
|
|
52
52
|
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@kbach/android": "1.0.0-beta.0"
|
|
55
|
+
},
|
|
53
56
|
"devDependencies": {
|
|
54
57
|
"@types/react": "^19.2.0",
|
|
55
58
|
"@types/react-test-renderer": "^19.1.0",
|