240 发简信
  • 我看 0.51 版本 ,startReactApplication()里面就已经包含了 mReactInstanceManager.createReactContextInBackground() 操作,这不是多此一举么
    public void startReactApplication(
    ReactInstanceManager reactInstanceManager,
    String moduleName,
    @Nullable Bundle initialProperties) {
    Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "startReactApplication");
    try {
    UiThreadUtil.assertOnUiThread();

    // TODO(6788889): Use POJO instead of bundle here, apparently we can't just use WritableMap
    // here as it may be deallocated in native after passing via JNI bridge, but we want to reuse
    // it in the case of re-creating the catalyst instance
    Assertions.assertCondition(
    mReactInstanceManager == null,
    "This root view has already been attached to a catalyst instance manager");

    mReactInstanceManager = reactInstanceManager;
    mJSModuleName = moduleName;
    mAppProperties = initialProperties;

    if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
    mReactInstanceManager.createReactContextInBackground();
    }

    attachToReactInstanceManager();

    } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
    }

    Android集成React Native启动白屏问题优化

    一、关于预加载方案预研 有一个方案是使用内存换取读取时间的一种折中的方案,网上通篇也说的这个方案。关于这个给大家一个链接,大家可以参考。React-Native 安卓预加载优...