mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-09-02 04:31:08 +00:00
feat(Android): Support Android file upload (#60)
Fixes #33 I could really use some help from an Android developer on this one, because I just "made it work", don't know how to "make it work good". Some things that should be reviewed: - [ ] validate Android 5.0 devices (my emulator work, but outputs some weird sounds; a Galaxy 4 I tested on crashes) - [ ] validate Android 5.1 devices (emulator works, couldn't find a real device) - [ ] how to handle File Extensions? (https://www.w3schools.com/tags/att_input_accept.asp) I'm sure that there's more refactoring to be done, so any help and advice would be appreciated.
This commit is contained in:
committed by
Thibault Malbranche
parent
f69942d70a
commit
752a5b295a
@@ -1,6 +1,7 @@
|
||||
|
||||
package com.reactnativecommunity.webview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -10,10 +11,19 @@ import com.facebook.react.bridge.NativeModule;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.bridge.JavaScriptModule;
|
||||
|
||||
public class RNCWebViewPackage implements ReactPackage {
|
||||
|
||||
private RNCWebViewManager manager;
|
||||
private RNCWebViewModule module;
|
||||
|
||||
@Override
|
||||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||
return Arrays.<NativeModule>asList(new RNCWebViewModule(reactContext));
|
||||
List<NativeModule> modulesList = new ArrayList<>();
|
||||
module = new RNCWebViewModule(reactContext);
|
||||
module.setPackage(this);
|
||||
modulesList.add(module);
|
||||
return modulesList;
|
||||
}
|
||||
|
||||
// Deprecated from RN 0.47
|
||||
@@ -23,7 +33,12 @@ public class RNCWebViewPackage implements ReactPackage {
|
||||
|
||||
@Override
|
||||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||
RNCWebViewManager viewManager = new RNCWebViewManager();
|
||||
return Arrays.<ViewManager>asList(viewManager);
|
||||
manager = new RNCWebViewManager();
|
||||
manager.setPackage(this);
|
||||
return Arrays.<ViewManager>asList(manager);
|
||||
}
|
||||
}
|
||||
|
||||
public RNCWebViewModule getModule() {
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user