Formally open-source and provide a working example - #12
Open
dvicory wants to merge 4 commits into
Open
Conversation
package.json has declared "license": "MIT" and "licenseFilename": "LICENSE" since the initial commit, but the file itself was never added.
ios/AEMultiWebview.{h,m} and ios/AEMultiWebView.{h,m} were both
tracked with identical contents, as were two spellings of the podspec.
A case-insensitive filesystem hid this: only one of each pair exists
on disk, so editing it appeared to modify both.
On a case-sensitive clone both spellings materialise, and the pod's
ios/**/*.{h,m} glob then compiles the class twice. Keep the spelling
that matches the class name.
The example could not be installed, let alone built: it pinned React Native 0.58 with a pre-CocoaPods Xcode project, and depended on a fork of react-native-webview that existed to change a single word - `copy` to `strong` on RNCWebViewImpl's private `webView` property. WKWebView does not conform to NSCopying, so without that change the technique this repo exists to demonstrate cannot work at all. Carry that change as a patch rather than a fork, and move the example to React Native 0.80.3 with react-native-webview 14.0.1. The subclass now extends RNCWebViewImpl/RNCWebViewManager and installs the parked web view before super's `_webView == nil` guard, so super does not create a second one. It also registers the estimatedProgress observer that super's removeFromSuperview unconditionally removes, and keeps its registry handle in a separate property because the upstream delegate protocol changed shape. Never pass onOpenWindow to this component. The subclass overrides the new-window hook but inherits decidePolicyForNavigationAction, which cancels the navigation when that prop is set - WebKit then never asks for a child web view, so nothing is ever parked. The New Architecture is not supported: the technique needs nativeConfig plus a custom RCTViewManager, so the example pins the legacy architecture, which React Native supports through 0.81 only. WebView.propTypes and WebView.extraNativeComponentConfig no longer exist and nativeConfig.viewManager is now a no-op on iOS, so all three are gone. Fix the tab bookkeeping while porting. Closing a tab spliced the routes array without renumbering the keys it also used for lookup, so keys are now stable and removal is by key. Scenes are rendered on demand rather than stored as JSX in state, dead findNewKey is gone, and an adopted tab no longer receives `source`: it already holds the document WebKit loaded, and applying the prop would clobber it. Declare what the library actually imports - react-native-tab-view and react-native-pager-view were never in peerDependencies - and modernize the podspec, which still asked for iOS 7.0 and the long-gone React pod. The harness needs three non-obvious pieces: an autolinking root override, because the CLI does not realpath the portal-linked library and would otherwise hand CocoaPods a path through node_modules; a metro extraNodeModules mapping, so requires from outside this directory resolve here; and `yarn www`, a dependency-free server for the fixture pages. The Android project, scaffold snapshot test and lint config are dropped - the technique is iOS-only, and that test could not resolve the portal-linked library. Also remove the postinstall script that swept the library copy out of example/node_modules. It is unnecessary now the library is linked as a portal, and actively dangerous: it deleted through the symlink.
Explain what the experiment did and why it has no upstream equivalent: react-native-webview's onOpenWindow reports a URL and returns nil, so window.open() yields null and the two pages cannot script each other. Record the constraint that shapes the design - WebKit demands a live WKWebView synchronously, before a JS round trip can render a tab - and the resulting parked-registry handoff. Include a recording, since nobody will build a legacy-architecture React Native app just to see this work.
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.
No description provided.