|
@@ -105,7 +105,6 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
105
|
105
|
// state and release page resources (including any running JavaScript).
|
106
|
106
|
protected static final String BLANK_URL = "about:blank";
|
107
|
107
|
protected WebViewConfig mWebViewConfig;
|
108
|
|
- private RNCWebViewPackage aPackage;
|
109
|
108
|
|
110
|
109
|
public RNCWebViewManager() {
|
111
|
110
|
mWebViewConfig = new WebViewConfig() {
|
|
@@ -171,15 +170,15 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
171
|
170
|
}
|
172
|
171
|
|
173
|
172
|
protected void openFileChooser(ValueCallback<Uri> filePathCallback, String acceptType) {
|
174
|
|
- getModule().startPhotoPickerIntent(filePathCallback, acceptType);
|
|
173
|
+ getModule(reactContext).startPhotoPickerIntent(filePathCallback, acceptType);
|
175
|
174
|
}
|
176
|
175
|
|
177
|
176
|
protected void openFileChooser(ValueCallback<Uri> filePathCallback) {
|
178
|
|
- getModule().startPhotoPickerIntent(filePathCallback, "");
|
|
177
|
+ getModule(reactContext).startPhotoPickerIntent(filePathCallback, "");
|
179
|
178
|
}
|
180
|
179
|
|
181
|
180
|
protected void openFileChooser(ValueCallback<Uri> filePathCallback, String acceptType, String capture) {
|
182
|
|
- getModule().startPhotoPickerIntent(filePathCallback, acceptType);
|
|
181
|
+ getModule(reactContext).startPhotoPickerIntent(filePathCallback, acceptType);
|
183
|
182
|
}
|
184
|
183
|
|
185
|
184
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
@@ -188,7 +187,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
188
|
187
|
String[] acceptTypes = fileChooserParams.getAcceptTypes();
|
189
|
188
|
boolean allowMultiple = fileChooserParams.getMode() == WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE;
|
190
|
189
|
Intent intent = fileChooserParams.createIntent();
|
191
|
|
- return getModule().startPhotoPickerIntent(filePathCallback, intent, acceptTypes, allowMultiple);
|
|
190
|
+ return getModule(reactContext).startPhotoPickerIntent(filePathCallback, intent, acceptTypes, allowMultiple);
|
192
|
191
|
}
|
193
|
192
|
});
|
194
|
193
|
reactContext.addLifecycleEventListener(webView);
|
|
@@ -218,7 +217,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
218
|
217
|
|
219
|
218
|
webView.setDownloadListener(new DownloadListener() {
|
220
|
219
|
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
221
|
|
- RNCWebViewModule module = getModule();
|
|
220
|
+ RNCWebViewModule module = getModule(reactContext);
|
222
|
221
|
|
223
|
222
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
224
|
223
|
|
|
@@ -552,16 +551,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
552
|
551
|
((RNCWebView) webView).cleanupCallbacksAndDestroy();
|
553
|
552
|
}
|
554
|
553
|
|
555
|
|
- public RNCWebViewPackage getPackage() {
|
556
|
|
- return this.aPackage;
|
557
|
|
- }
|
558
|
|
-
|
559
|
|
- public void setPackage(RNCWebViewPackage aPackage) {
|
560
|
|
- this.aPackage = aPackage;
|
561
|
|
- }
|
562
|
|
-
|
563
|
|
- public RNCWebViewModule getModule() {
|
564
|
|
- return this.aPackage.getModule();
|
|
554
|
+ public RNCWebViewModule getModule(ReactContext reactContext) {
|
|
555
|
+ return reactContext.getNativeModule(RNCWebViewModule.class);
|
565
|
556
|
}
|
566
|
557
|
|
567
|
558
|
protected static class RNCWebViewClient extends WebViewClient {
|