You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Three defaults changed in the 1.1.x line. Each is a one-line migration:
39
39
- 🛡️ Sanity guard clamps runaway heights and retries with the last good value, so flaky pages never lock your layout.
40
40
- 🧵 Keeps the WebView scroll-disabled so outer `ScrollView`s and gesture handlers stay silky smooth.
41
41
- 🎨 Transparent background by default; style the container however you like.
42
-
- ⚙️ Friendly API with `minHeight`, `containerStyle`, and `onHeightChange` callbacks.
42
+
- ⚙️ Friendly API with `minHeight`, `containerStyle`, `loadingContainerStyle`, and `onHeightChange` callbacks.
43
43
- 🌲 ESM-first build, fully typed, `sideEffects: false` for optimal tree shaking.
44
44
- 📱 Verified on iOS, Android, and Expo Go out of the box.
45
45
@@ -100,6 +100,7 @@ The example showcases:
100
100
| --- | --- | --- | --- |
101
101
|`minHeight`|`number`|`0`| Minimum height (dp) applied to the container. When `0`, the container is unsized until the first measurement arrives (avoids layout flicker and the iOS 26 WKWebView 1px feedback loop). |
102
102
|`containerStyle`|`StyleProp<ViewStyle>`| — | Styles applied to the wrapping `View`. Use it for padding, borders, or shadows. Do not set `height` — it is managed by the hook. |
103
+
|`loadingContainerStyle`|`StyleProp<ViewStyle>`| — | Styles applied to the wrapping `View`**only while height is still being measured** (i.e. while the bridge has not yet reported a value). Use `{ flex: 1 }` inside a `ScrollView` with `contentContainerStyle={{ flexGrow: 1 }}` so the native activity indicator is never clipped. Dropped automatically once the first measurement commits. |
103
104
|`onHeightChange`|`(height: number) => void`| — | Callback fired whenever a new height is committed. Great for analytics or debugging. Never fires for invalid or out-of-range values. |
104
105
|`originWhitelist`|`string[]`|`['http://*', 'https://*']`| Origins the WebView is allowed to navigate to. Blocks non-web schemes (`file:`, `javascript:`, `data:`, `intent:`) by default. Tighten it to a specific origin list for stricter environments. |
105
106
|`javaScriptEnabled`|`boolean`|`true`| When `false`, the auto-height bridge is **not** injected and the container falls back to `minHeight`. Use for static HTML that doesn't need JS. |
@@ -108,6 +109,26 @@ The example showcases:
108
109
> [!NOTE]
109
110
> 🧩 `scrollEnabled` defaults to `false` so sizing remains deterministic. Only enable it if the WebView should manage its own scroll.
110
111
112
+
### Loading state inside a `ScrollView`
113
+
114
+
When `minHeight` is `0` (the default), the container has no height until the bridge reports the first measurement. Inside a `ScrollView` this means the native loading spinner is rendered in a 0 dp frame and gets clipped.
- During loading: container is `[{ flex: 1 }, containerStyle]` — fills the scroll area, spinner is fully visible.
130
+
- After measurement: container becomes `[{ height: N }, containerStyle]` — shrinks to content height, `loadingContainerStyle` is dropped.
131
+
111
132
## 🛡️ Security
112
133
113
134
-**Namespaced message protocol.** The injected bridge posts values prefixed with `__RN_SIZED_WV__:` and the hook rejects everything else, so your own `onMessage` traffic cannot accidentally (or maliciously) mutate the container height.
0 commit comments