Browse Source

Report onActivityResult to RN

Guy Carmeli 6 years ago
parent
commit
a0982e404d

+ 7
- 0
lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java View File

1
 package com.reactnativenavigation;
1
 package com.reactnativenavigation;
2
 
2
 
3
+import android.content.Intent;
3
 import android.os.Bundle;
4
 import android.os.Bundle;
4
 import android.support.annotation.Nullable;
5
 import android.support.annotation.Nullable;
5
 import android.support.v7.app.AppCompatActivity;
6
 import android.support.v7.app.AppCompatActivity;
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
     @Override
60
     @Override
54
     public void onBackPressed() {
61
     public void onBackPressed() {
55
         getReactGateway().onBackPressed();
62
         getReactGateway().onBackPressed();

+ 1
- 0
lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java View File

62
      * @param name Unique name used to register the native view
62
      * @param name Unique name used to register the native view
63
      * @param creator Used to create the view at runtime
63
      * @param creator Used to create the view at runtime
64
      */
64
      */
65
+    @SuppressWarnings("unused")
65
     public void registerExternalComponent(String name, ExternalComponentCreator creator) {
66
     public void registerExternalComponent(String name, ExternalComponentCreator creator) {
66
         if (externalComponents.containsKey(name)) {
67
         if (externalComponents.containsKey(name)) {
67
             throw new RuntimeException("A component has already been registered with this name: " + name);
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 View File

1
 package com.reactnativenavigation.react;
1
 package com.reactnativenavigation.react;
2
 
2
 
3
+import android.app.Activity;
3
 import android.app.Application;
4
 import android.app.Application;
5
+import android.content.Intent;
4
 
6
 
5
 import com.facebook.react.ReactNativeHost;
7
 import com.facebook.react.ReactNativeHost;
6
 import com.facebook.react.ReactPackage;
8
 import com.facebook.react.ReactPackage;
63
     public void onBackPressed() {
65
     public void onBackPressed() {
64
 	    reactNativeHost.getReactInstanceManager().onBackPressed();
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
 }