Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade react-native-webview #1282

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.reactnativecommunity.webview.RNCWebView;
import com.reactnativecommunity.webview.RNCWebViewClient;
import com.reactnativecommunity.webview.RNCWebViewManager;
import com.reactnativecommunity.webview.RNCWebViewWrapper;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
Expand All @@ -33,8 +36,8 @@ public class IndexInjectionWebViewManager extends RNCWebViewManager {
private static final String TAG = "IndexInjectionWebView";

@Override
protected RNCWebView createRNCWebViewInstance(ThemedReactContext reactContext) {
return new IndexInjectionWebView(reactContext);
public RNCWebViewWrapper createViewInstance(ThemedReactContext reactContext) {
return super.createViewInstance(reactContext, new IndexInjectionWebView(reactContext));
}

@Override
Expand All @@ -43,13 +46,13 @@ public String getName() {
}

@Override
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
view.setWebViewClient(new IndexInjectionWebViewClient());
protected void addEventEmitters(ThemedReactContext reactContext, RNCWebViewWrapper view) {
view.getWebView().setWebViewClient(new IndexInjectionWebViewClient());
}

@ReactProp(name = "injectedIndex")
public void setInjectedIndex(WebView view, String url) {
((IndexInjectionWebView) view).setInjectedIndex(url);
public void setInjectedIndex(RNCWebViewWrapper view, String url) {
((IndexInjectionWebView) view.getWebView()).setInjectedIndex(url);
}

protected static class IndexInjectionWebViewClient extends RNCWebViewClient {
Expand Down Expand Up @@ -78,8 +81,7 @@ public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceReque
}

protected static class IndexInjectionWebView extends RNCWebView {
protected @Nullable
String mInjectedIndex;
protected @Nullable String mInjectedIndex;

public IndexInjectionWebView(ThemedReactContext reactContext) {
super(reactContext);
Expand Down
5 changes: 3 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ PODS:
- react-native-slider (4.4.4):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-webview (11.18.2):
- react-native-webview (13.13.1):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- React-NativeModulesApple (0.72.12):
- hermes-engine
Expand Down Expand Up @@ -1096,7 +1097,7 @@ SPEC CHECKSUMS:
react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-slider: 2a78c87e19a8b2b9837037fcb68dce4be73e335a
react-native-webview: 8ec7ddf9eb4ddcd92b32cee7907efec19a9ec7cb
react-native-webview: 93adcfce70194c3d7aaf178c0c6e7934c2e22960
React-NativeModulesApple: 694679e4193a49c09f0a76ee27ec09b2c466d59c
React-perflogger: 63606aeab27683112e1bd4ef25bd099ec1cb03f8
React-RCTActionSheet: 5b39fc2b479d47325e5ac95193c482044bfebbc6
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"react-native-svg": "13.14.0",
"react-native-toast-message": "2.1.6",
"react-native-url-polyfill": "^1.3.0",
"react-native-webview": "github:cozy/react-native-webview#1.0.3",
"react-native-webview": "^13.13.1",
"react-redux": "^8.0.5",
"react-scripts": "4.0.3",
"redux-logger": "3.0.6",
Expand Down
9 changes: 5 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16839,11 +16839,12 @@ react-native-url-polyfill@^1.3.0:
dependencies:
whatwg-url-without-unicode "8.0.0-3"

"react-native-webview@github:cozy/react-native-webview#1.0.3":
version "11.18.2"
resolved "https://codeload.github.com/cozy/react-native-webview/tar.gz/622fae7bb357a2d1ab25bf46bafdf821780b4b4b"
react-native-webview@^13.13.1:
version "13.13.1"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-13.13.1.tgz#a016557afc02126175f151caaed545abbdef4eb2"
integrity sha512-Qwrvdwl2U2bG8QlghfRzGR/PCwKzW/cXTCR/WfMWHeGoADp2CHuCaEpfYO/HhlLLGy3Jqizsy+sjFhnKa1AgrA==
dependencies:
escape-string-regexp "2.0.0"
escape-string-regexp "^4.0.0"
invariant "2.2.4"

react-native@0.72.12:
Expand Down
Loading