简体   繁体   中英

Unable to call React native function from Android

I am trying to call a function from native to react native . But I am getting this runtime exception

Tried to access a JS module before the React instance was fully set up. Calls to "
          + "ReactContext#getJSModule should only happen once initialize() has been called on your "
          + "native module.";

I am following Facebook react native documentation. And did went through many questions regarding this topic but nothing helps my issue.I am getting CatalystInstance null in getJsmodule.

After debugging I got to know that I was missing current react context in MyActivity which is required to call getJSModule . So I extends my MainActivity from Activity to ReactActivity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM