Reactjs 如果我们从片段启动应用程序,SetTimeOut在React Native中不工作
我正在将react native集成到我现有的android应用程序中。我有一个片段,从这个片段开始,我启动React原生模块。 下面是从Android片段启动模块的代码Reactjs 如果我们从片段启动应用程序,SetTimeOut在React Native中不工作,reactjs,react-native,fragment,Reactjs,React Native,Fragment,我正在将react native集成到我现有的android应用程序中。我有一个片段,从这个片段开始,我启动React原生模块。 下面是从Android片段启动模块的代码 @Override public ReactRootView onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //
@Override
public ReactRootView onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
SoLoader.init(getActivity(), /**/ false);
ReactRootView mReactRootView = new ReactRootView(getActivity());
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getActivity().getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index")
.addPackage(new MainReactPackage())
.addPackage(new RNGestureHandlerPackage())
.addPackage(new RNDeviceInfo())
.addPackage(new ReactCallbackManagerPackage(this))
.addPackage(new ReanimatedPackage())
.addPackage(new VectorIconsPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "reactnativemodule", initialProps);
}
一切正常,除了
setTimeout(function () {
data.events = [];
resolvePreInitHooks();
resolve();
}, 1000);
他没有打电话<代码>设置超时代码应在1秒后执行,但未执行