ReactNative分包加载JS报错this._lazyCallableModules[e] is not a function

ReactNative在0.45版本以后,包括0.45版本,对RN框架进行了修改,导致如果在加载框架代码之后,立刻加载业务代码会报错this._lazyCallableModules[e] is not a function. (In 'this._lazyCallableModules[e]()', 'this._lazyCallableModules[e]' is undefined)


ReactNative分包加载JS报错this._lazyCallableModules[e] is not a function_第1张图片

找了很久原因,其实也很简单,在RCTRootView.m文件里有一句话

// Immediately schedule the application to be started.

// (Sometimes actual `_bridge` is already batched bridge here.)

[selfbundleFinishedLoading:([_bridgebatchedBridge] ?:_bridge)];

看注释就很扯淡,�简单修改一下成

if(!_bridge.loading)

{

[selfbundleFinishedLoading:([_bridgebatchedBridge] ?:_bridge)];

}

就这么简单。

你可能感兴趣的:(ReactNative分包加载JS报错this._lazyCallableModules[e] is not a function)