@kbach/react-native 1.0.0-beta.50 → 1.0.0-beta.52

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/AGENTS.md CHANGED
@@ -9,6 +9,23 @@ cross-package overview, `kbach.config.js` reference, the color palette,
9
9
  and how the underlying engine is built, see the repo root's
10
10
  [AGENTS.md](https://github.com/semsakadanupol/kbach/blob/main/AGENTS.md).
11
11
 
12
+ > **Before writing a single class here, know these three things —
13
+ > Tailwind familiarity actively misleads on all three:**
14
+ >
15
+ > 1. Color shades are `1`–`12` (lightest→darkest), not Tailwind's
16
+ > `50`–`950` — `bg-blue-500` resolves to nothing; the real class is
17
+ > `bg-blue-6`. Full palette: root AGENTS.md §6.
18
+ > 2. `group-*`, `peer-*`, `has-[…]`, container queries, grid, and pseudo-
19
+ > elements (`before:`/`after:`) are real Tailwind syntax that PARSES
20
+ > here but applies **zero style, with no warning** — native has no
21
+ > cascade/DOM to support them. See §4's "Not supported" list. A typo
22
+ > DOES warn; an unsupported-but-valid utility does not — don't assume
23
+ > silence means it worked.
24
+ > 3. The babel plugin (§1 below) is required on **every** target,
25
+ > including Expo Go — without it `className` does literally nothing,
26
+ > silently, no error. This is the single most common real setup bug
27
+ > reported against this package.
28
+
12
29
  ---
13
30
 
14
31
  ## 1. Install + setup
@@ -220,6 +237,23 @@ Outside React: `getGlobalDarkMode()` / `toggleGlobalDarkMode()` /
220
237
  engine (a space splits the class token). Use underscores if you want them
221
238
  for readability: `w-[calc(100%_-_3rem)]`.
222
239
 
240
+ ### 7.1 Arbitrary values elsewhere — same px/rem-only rule
241
+
242
+ Not just `calc()`: any arbitrary value RN needs as a plain number (font
243
+ size, spacing, radii, ...) follows the identical rule. `text-[20px]` and
244
+ `text-[1.5rem]` work (`rem` × 16, same as everywhere else); `text-[2em]`,
245
+ `text-[50%]`, `text-[10vh]`/`text-[10vw]` don't — `em` needs the parent's
246
+ own cascaded font-size and `%`/viewport units need real layout, neither
247
+ of which exists at native resolve time — dropped with the same dev-only
248
+ `console.warn`, never a crash. Identical on Expo Go's JS-fallback engine
249
+ (`jsEngine/resolveStyle.ts` mirrors `resolve_style.rs`'s `rn_style_value`
250
+ exactly). Web (including Expo Web) has none of this restriction — real
251
+ CSS resolves every unit natively.
252
+
253
+ **`text-[…]` specifically needs `< 1.0.0-beta.52` excluded** — every
254
+ arbitrary `text-[…]` value, including a plain `text-[10px]`, silently
255
+ resolved nothing at all on native/Expo Go before that version (see §13).
256
+
223
257
  ## 8. Dynamic tokens (native counterpart to CSS custom properties)
224
258
 
225
259
  ```tsx
@@ -345,3 +379,27 @@ Subpath exports: `@kbach/react-native/babel-plugin`,
345
379
  missing. It's required on every target, not just Android/dev-client
346
380
  builds; without it nothing routes `className` through this package's
347
381
  jsx-runtime at all, so RN just silently ignores the unrecognized prop.
382
+ - **`ERROR [Error: Unable to find node on an unmounted component.]` on
383
+ Expo Fast Refresh, especially right after editing `kbach.config.js`** —
384
+ stale `@kbach/react-native` (`< 1.0.0-beta.51`). Root cause: the babel
385
+ plugin (§1) injects `applyKbachConfig(require('kbach.config.js'))` into
386
+ *every* user file, so editing that config forces Metro to re-execute the
387
+ entire app (every file requires it), not just the screen you're on;
388
+ before beta.51, `setTheme` (`theme.ts`) handed every one of those
389
+ redundant re-applications a brand-new theme object even when the config
390
+ content hadn't changed, invalidating every `useColors()` memo and
391
+ reactive-element check across the whole tree simultaneously, right as
392
+ Fast Refresh was already mid-teardown — worsening this normally-rare
393
+ React Native Fast Refresh race. `setTheme` is idempotent by content
394
+ since beta.51 (compares against the theme's own JSON serialization
395
+ before replacing it); update.
396
+ - **`text-[10px]` (or any other arbitrary `text-[…]` value) does nothing
397
+ on native or Expo Go** — stale `@kbach/react-native` (`< 1.0.0-beta.52`).
398
+ The native dispatcher's `resolve_text_native` (`resolvers/mod.rs`) never
399
+ got the arbitrary-value length check `color::resolve_text` (web) already
400
+ had — an arbitrary value skipped the font-size/align lookup entirely and
401
+ fell straight through to color resolution, which correctly rejected
402
+ "10px" as not a real color and silently dropped the whole declaration.
403
+ Fixed identically in both the Rust native dispatcher and its Expo Go JS-
404
+ fallback mirror (`jsEngine/resolveUtilityNative.ts`) in beta.52; update.
405
+ Web (including Expo Web) was never affected.
package/README.md CHANGED
@@ -15,6 +15,13 @@ Utility-class styling for React Native — the same class names as
15
15
  npm install @kbach/react-native@beta
16
16
  ```
17
17
 
18
+ Or skip straight to a working setup: `npx @kbach/cli init` detects Expo
19
+ or React Native CLI, installs this package, and patches
20
+ `babel.config.js` for you (on React Native CLI, it'll even offer to run
21
+ the native rebuild) — see [`@kbach/cli`](https://www.npmjs.com/package/@kbach/cli).
22
+ The steps below are what it automates, and still the fallback it prints
23
+ if your `babel.config.js`'s shape is too unusual for it to edit safely.
24
+
18
25
  ## Setup
19
26
 
20
27
  The babel plugin (below) is **required on every target, including Expo
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getTheme
3
- } from "./chunk-3KLOVONL.mjs";
3
+ } from "./chunk-Z5Q3FGXR.mjs";
4
4
 
5
5
  // src/darkModeStore.ts
6
6
  import { Appearance } from "react-native";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveClassName
3
- } from "./chunk-3KLOVONL.mjs";
3
+ } from "./chunk-Z5Q3FGXR.mjs";
4
4
 
5
5
  // src/jsxRuntimeCoreWeb.ts
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";