tamer-webview
Embedded in-app WebView for Lynx: iOS WKWebView, Android android.webkit.WebView. Registers the native custom element <webview> with props such as uri, html, and baseUrl (no JSON blob on the JS side). There is no React wrapper component—you use <webview> in JSX.
Behavior and API are informed by react-native-webview (see reference/react-native-webview in this repo). Pages can post messages to the app using the same bridge name as RN: ReactNativeWebView (window.ReactNativeWebView.postMessage(...)).
Installation
The CLI resolves npm’s default installable version for the package. Then run t4l link so native projects pick up lynx.ext.json, CocoaPods, and Gradle. t4l link also refreshes .tamer/tamer-components.d.ts and your tsconfig.json include when syncTamerComponentTypes is enabled (default in tamer.config.json).
Requirements
- Native host must register the element (autolink does this for Tamer dev app and embeddable).
- ATS (iOS) / cleartext (Android): loading non-HTTPS URLs may require app-side configuration (
NSAppTransportSecurity,usesCleartextTraffic, etc.).
TypeScript
Ambient typings live in dist/webview-jsx.d.ts (declared in package.json exports["./webview-jsx"] and tamer.ambientTypeExports). They augment @lynx-js/types so <webview> is typed.
Typings: t4l init / t4l link generate .tamer/tamer-components.d.ts with path references into node_modules/.../dist/webview-jsx.d.ts and update tsconfig.json include when syncTamerComponentTypes is enabled (default). You do not need import '@tamer4lynx/tamer-webview' for types alone—that file is enough. If the Lynx app uses src/tsconfig.json, include ../.tamer/tamer-components.d.ts there as well—see Ambient types (CLI).
Import the package only when you use JS exports (imperative helpers):
Usage
If uri is non-empty, it is loaded first. Otherwise html + optional baseUrl are used.
Props (WebViewProps)
These match packages/tamer-webview/src/types.ts (ambient <webview> uses the same shape).
Native defaults (not encoded in TypeScript): javaScriptEnabled and messagingEnabled default to true on iOS/Android; userAgent falls back to a Chrome Mobile–style UA when unset.
Events
Handlers use Lynx BaseEvent: e.detail carries the payload (not React-style).
Imperative APIs (invoke / WebViewRef)
Use NodesRef.invoke with callWebViewMethod, or useWebViewRef() — the ref’s imperative surface is WebViewRef in packages/tamer-webview/src/index.tsx.
See also
- Ambient types (CLI) —
.tamer/tamer-components.d.tsandtsconfigwiring - Custom Element (Lynx)
- NodesRef
invoke
