2

I have a native Android SDK that I need to interact with from a React Native application. For this I have built a native module to interact with the SDK on the application level

Unfortunately I have encountered a problem while implementing, the SDK exposes a delegator that the client can override to influence the SDKs behavior. Most of its methods were simple to implement with events, but two of them need to return a boolean value.

I need to somehow be able to call a js method from my native module and get a boolean value back. I have seen this solution but it does not suit my needs as this method does not return a value.

A google search has yielded no information on this matter, is it even possible?

I would be happy to share code if necessary, any help would be appreciated.

1 Answers1

0

This discussion might be helpful: Call JavaScript function from native code. It suggests sending an event to the JS side that would trigger a function which then would send the data back to the native side.

Another question mentions headless JS for background tasks but that doesn't seem to be your case: How to call a JavaScript function from native on a React native app

  • Hi, thank you for the answer. I have used events for some of the functionality of the module but in this case it does not fulfill my requirements. I need to be able to call a function that returns a value (this method needs this value to finish it's work) Also, i can't make any changes to the SDK – Dan Gavrielov Sep 15 '22 at 04:44