@kbach/react-native 1.0.0-beta.5 → 1.0.0-beta.7

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 CHANGED
@@ -96,9 +96,12 @@ Kotlin/JNI bridge, so on web this package resolves classes through the
96
96
  same Rust engine [`@kbach/react`](https://www.npmjs.com/package/@kbach/react)
97
97
  uses — WASM instead of JNI — automatically. Metro picks the right
98
98
  implementation per platform on its own via this package's `"browser"`
99
- export condition; your app code and JSX never change. The WASM module
100
- initializes itself eagerly (synchronously, at import time — no `await`
101
- needed before your first render, unlike a from-scratch WASM setup).
99
+ (client bundles) and `"node"` (Expo Router's static-rendering/SSR bundles
100
+ — a genuinely separate resolution axis from `platform: 'web'`, see
101
+ `nativeBridge.web.ts`'s own doc comment) export conditions; your app code
102
+ and JSX never change. The WASM module initializes itself eagerly
103
+ (synchronously, at import time — no `await` needed before your first
104
+ render, unlike a from-scratch WASM setup).
102
105
 
103
106
  The only thing this doesn't cover on web is an iOS-parity feature gap —
104
107
  everything web-side resolves through the exact same
@@ -106,6 +109,49 @@ everything web-side resolves through the exact same
106
109
  logic real native uses, so see this README's "What this is" section above
107
110
  for what's covered.
108
111
 
112
+ #### Expo Router static rendering: `dark:`/responsive on the FIRST paint
113
+
114
+ If you use [static rendering](https://docs.expo.dev/router/reference/static-rendering/)
115
+ (`web.output: "static"` — Expo Router's SSR/pre-render feature), any
116
+ `dark:`/`sm:`/etc. class on content that's part of the **initial,
117
+ pre-rendered HTML** resolves against whatever the **server** (Node.js, no
118
+ real display/viewport) reports — not the visiting browser's actual OS
119
+ preference or window size. React's hydration then adopts that
120
+ server-rendered markup as-is rather than silently overwriting it with the
121
+ client's own (correct) values, because a `style`-attribute-only difference
122
+ doesn't fail hydration the way a text-content mismatch does. Concretely: a
123
+ user with their OS in dark mode can see a `dark:` class resolve to its
124
+ *light* value on first paint, with no error or warning anywhere.
125
+
126
+ **This isn't a Kbach bug** — it's the same fundamental constraint every
127
+ OS-preference-based styling system has under SSR (Next.js's own dark-mode
128
+ docs describe the identical problem and fix). The standard fix applies
129
+ here unchanged: don't resolve preference-dependent classes on
130
+ initially-server-rendered content at all; defer them to after your app has
131
+ mounted client-side, e.g.:
132
+
133
+ ```tsx
134
+ import { useEffect, useState } from 'react';
135
+ import { Text, View } from 'react-native';
136
+
137
+ function ThemedScreen() {
138
+ const [mounted, setMounted] = useState(false);
139
+ useEffect(() => setMounted(true), []);
140
+
141
+ // Neutral on the server AND on the client's first paint (matches exactly,
142
+ // no hydration mismatch) — only becomes preference-aware once mounted.
143
+ return (
144
+ <View className={mounted ? 'bg-gray-1 dark:bg-gray-12' : 'bg-gray-1'}>
145
+ <Text>Hello</Text>
146
+ </View>
147
+ );
148
+ }
149
+ ```
150
+
151
+ Content that only ever renders client-side (not part of the statically
152
+ pre-rendered route) is unaffected — this only matters for what's visible
153
+ before your first `useEffect` runs.
154
+
109
155
  ## What this is
110
156
 
111
157
  - A JSX runtime (`@kbach/react-native/jsx-runtime`) that intercepts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveStyle
3
- } from "./chunk-KSDFO34H.mjs";
3
+ } from "./chunk-T3HPTH62.mjs";
4
4
  import {
5
5
  createJsxFunctions
6
6
  } from "./chunk-DLIXI5OW.mjs";