Bladeren bron

Report onActivityResult to RN

Guy Carmeli 6 jaren geleden
bovenliggende
commit
a0982e404d

+ 7
- 0
lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java Bestand weergeven

@@ -1,5 +1,6 @@
1 1
 package com.reactnativenavigation;
2 2
 
3
+import android.content.Intent;
3 4
 import android.os.Bundle;
4 5
 import android.support.annotation.Nullable;
5 6
 import android.support.v7.app.AppCompatActivity;
@@ -50,6 +51,12 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
50 51
         }
51 52
     }
52 53
 
54
+    @Override
55
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
56
+        super.onActivityResult(requestCode, resultCode, data);
57
+        getReactGateway().onActivityResult(this, requestCode, resultCode, data);
58
+    }
59
+
53 60
     @Override
54 61
     public void onBackPressed() {
55 62
         getReactGateway().onBackPressed();

+ 1
- 0
lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java Bestand weergeven

@@ -62,6 +62,7 @@ public abstract class NavigationApplication extends Application implements React
62 62
      * @param name Unique name used to register the native view
63 63
      * @param creator Used to create the view at runtime
64 64
      */
65
+    @SuppressWarnings("unused")
65 66
     public void registerExternalComponent(String name, ExternalComponentCreator creator) {
66 67
         if (externalComponents.containsKey(name)) {
67 68
             throw new RuntimeException("A component has already been registered with this name: " + name);

+ 6
- 0
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java Bestand weergeven

@@ -1,6 +1,8 @@
1 1
 package com.reactnativenavigation.react;
2 2
 
3
+import android.app.Activity;
3 4
 import android.app.Application;
5
+import android.content.Intent;
4 6
 
5 7
 import com.facebook.react.ReactNativeHost;
6 8
 import com.facebook.react.ReactPackage;
@@ -63,4 +65,8 @@ public class ReactGateway {
63 65
     public void onBackPressed() {
64 66
 	    reactNativeHost.getReactInstanceManager().onBackPressed();
65 67
     }
68
+
69
+    public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
70
+        reactNativeHost.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data);
71
+    }
66 72
 }