1

I want to startActivityForResult with a custom Intent's, but I think react native doesn't supported it.

what is the best solution to implement it?

my startActivityForResult function:

        Intent intent = new Intent(Intent.ACTION_MAIN); // set payment parameters
        intent.setComponent(new ComponentName(pakageName, "wish.*.*"));
        intent.putExtra("paymentId", paymentId);
        this.getActivity().startActivityForResult(intent,RETURN_PAYMENT);
S.M_Emamian
  • 17,005
  • 37
  • 135
  • 254

2 Answers2

-1

The question is 2 years old but I could give you a suggestion if anyone still need a solution.

In React we do have React hooks, React context that allowed you to share data between react components.

Besides that you able to use redux/mobx to handle data flow but I do not recommend it because of using the complex things to solve a small issue.

In cases of using react-navigation, you able to combine react hooks with react-navigation hooks to receive callback data.

Nguyễn Anh Tuấn
  • 1,023
  • 1
  • 12
  • 19
-2

You can write a custom module for starting the activity and you can use callbacks to send activity result to the react side. https://facebook.github.io/react-native/docs/native-modules-android

cancit
  • 172
  • 5