feat(mobile-ui): webview php + fullscreen modes#10
Open
simonhamp wants to merge 1 commit into
Open
Conversation
`<x-webview php />` swaps the locked-down sandbox for the app's own enriched Laravel webview — pages served by the embedded PHP runtime with the full window.Native bridge, shared session store, and asset pipeline. `src` becomes an app route path; empty/relative falls back to the app's configured start URL. iOS builds an independent WKWebView wired like the shell's classic one (PHPSchemeHandler on php://, shared WebView.dataStore, addNativeHelper user scripts borrowed from the shell). Android runs the full WebViewManager.setup() wiring on a renderer-owned WebView, restoring the process-wide `shared` slot afterwards and wrapping the stock client so its "page load = web mode" isActive flip can't unmount the native tree this webview lives inside. `<x-webview fullscreen />` gives the v3 default-webview presentation: fill layout from the PHP side plus ignoresSafeArea on iOS. Also fixes `@navigated` never firing: `_navigated` isn't in the collector's callback allowlist, so the element now wires it in applyAttributes itself. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Expands
<x-webview />with two bare boolean attributes:fullscreen<x-webview fullscreen />— the v3 default-webview presentation. The PHP element appliesfilllayout; the iOS renderer additionally extends behind the safe areas (.ignoresSafeArea(.container, edges: .all)). On Android edge-to-edge follows from fill layout plus the shell's transparent system bars.php<x-webview php />— swaps the locked-down sandbox for the app's own enriched Laravel webview: pages served by the embedded PHP runtime with the fullwindow.Nativebridge, shared session, and asset pipeline.srcbecomes an app route path (<x-webview php src="/dashboard" />); omitted, the app's configured start URL loads.iOS (
PHPWebViewContainer): an independent WKWebView wired exactly like the shell's classic webview —PHPSchemeHandleronphp://, sharedWebView.dataStore(same Laravel session), and the shell'saddNativeHelperuser scripts (safe-area CSS vars +window.Native). External-scheme links open via the system. Unlike the shell coordinator, ours never togglesNativeUIBridgeweb/native mode — this webview lives inside the native tree.Android (
PhpWebView): a renderer-owned WebView run through the framework's fullWebViewManager.setup()(settings, cookies,http://127.0.0.1PHP interception, POST-capture bridge,window.Nativeinjection), with two integration hazards defused:setup()claims the process-wideWebViewManager.sharedslot → restored to the app's root manager immediately after.NativeUIBridge.isActive = falseon every page load — correct for the root webview, fatal for one embedded inside the native tree (it would unmount this very renderer). A delegatingPhpEmbedClientkeeps everything the stock client does (including the POST-inspector script injection) and re-asserts native-UI mode.Bug fix
@navigatedon the existing webview never fired:_navigatedisn't inNativeElementCollector::applyCallbacks' allowlist, so the Blade sugar was silently dropped. The element now wires it itself inapplyAttributes.Verification
tests/WebviewTest.php: 6 collector-driven tests (sandbox defaults, opt-ins, fullscreen prop + fill layout,fullscreen="false", php mode,@navigatedregistration)nativephp/mobile4.0.0-rc.1: 89 tests, 451 assertionsPHPSchemeHandler,WebView.dataStore,addNativeHelper,WebViewManager.shared,MainActivity.instance, companiongetStartURL,minSdk≥ 26 forgetWebViewClient())php-mode renderers are new native code that hasn't rendered a frame on a simulator/deviceNote
Stacked on #7 (
feat/webview-element) — merge that first; GitHub retargets this tomainwhen the base branch is deleted.🤖 Generated with Claude Code