[英]Unable to call React native function from Android
I am trying to call a function from native to react native .我正在尝试从 native 调用一个函数来响应 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.我正在关注 Facebook React Native 文档。 And did went through many questions regarding this topic but nothing helps my issue.I am getting CatalystInstance null in getJsmodule.
并且确实解决了许多关于这个主题的问题,但没有任何帮助我的问题。我在 getJsmodule 中得到 CatalystInstance null。
After debugging I got to know that I was missing current react context in MyActivity which is required to call getJSModule
.调试后,我知道我缺少 MyActivity 中的当前反应上下文,这是调用
getJSModule
所需的。 So I extends my MainActivity from Activity to ReactActivity.所以我将我的 MainActivity 从 Activity 扩展到 ReactActivity。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.