Ability to upload other file types (#1662)

This commit is contained in:
Elias Nahum
2018-05-11 18:05:49 -03:00
committed by GitHub
parent 76e664cdae
commit 23ca490525
15 changed files with 285 additions and 2 deletions

View File

@@ -89,6 +89,23 @@ public class ShareModule extends ReactContextBaseJavaModule {
promise.resolve(processIntent());
}
@ReactMethod
public void getFilePath(String filePath, Promise promise) {
Activity currentActivity = getCurrentActivity();
WritableMap map = Arguments.createMap();
if (currentActivity != null) {
Uri uri = Uri.parse(filePath);
String path = RealPathUtil.getRealPathFromURI(currentActivity, uri);
if (path != null) {
String text = "file://" + path;
map.putString("filePath", text);
}
}
promise.resolve(map);
}
public WritableArray processIntent() {
WritableMap map = Arguments.createMap();
WritableArray items = Arguments.createArray();