7

I have a react-native app and want to integrate it with native SDK. At some point I need to call js function which will return me data, and this call I should make from native side. Here is the flow:

  1. some iOS handler require more info
  2. native layer calls js code
  3. js code calculate/fetch required data
  4. js code return data back to native code
  5. native code receive data and continue working

Is it possible? There is a lib react-native-eval but may be there is more elegant way to do this?

Dheeraj Vepakomma
  • 26,870
  • 17
  • 81
  • 104
Alexei Malashkevich
  • 1,575
  • 1
  • 17
  • 34

1 Answers1

3

There is currently no clean way of doing this. My suggestion would be to use either a Callback or an Event from native to JS to notify that there is some information needed and to then invoke a function from JS to the native code that gives the required data to the native layer.

Peterdeka
  • 387
  • 5
  • 19
Daniel Schmidt
  • 11,605
  • 5
  • 38
  • 70