Java Code Examples for com.facebook.react.ReactInstanceManagerBuilder#build()

The following examples show how to use com.facebook.react.ReactInstanceManagerBuilder#build() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesPackage(getJSIModulePackage())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 2
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesPackage(getJSIModulePackage())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 3
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 4
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesPackage(getJSIModulePackage())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 5
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesProvider(getJSIModulesProvider())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 6
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesPackage(getJSIModulePackage())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 7
Source File: NavigationReactNativeHost.java    From react-native-navigation with MIT License 6 votes vote down vote up
protected ReactInstanceManager createReactInstanceManager() {
    ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setJSMainModulePath(getJSMainModuleName())
            .setUseDeveloperSupport(getUseDeveloperSupport())
            .setRedBoxHandler(getRedBoxHandler())
            .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
            .setUIImplementationProvider(getUIImplementationProvider())
            .setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
            .setJSIModulesPackage(getJSIModulePackage())
            .setDevBundleDownloadListener(getDevBundleDownloadListener());

    for (ReactPackage reactPackage : getPackages()) {
        builder.addPackage(reactPackage);
    }

    String jsBundleFile = getJSBundleFile();
    if (jsBundleFile != null) {
        builder.setJSBundleFile(jsBundleFile);
    } else {
        builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
    }
    return builder.build();
}
 
Example 8
Source File: QtalkServiceExternalRNViewInstanceManager.java    From imsdk-android with MIT License 5 votes vote down vote up
public static boolean buildBundle(Activity mActivity, String bundleName, String Entrance) {
        boolean is_ok = false;

        try {
            ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
                    .setApplication(mActivity.getApplication())
                    .setJSMainModulePath(Entrance)
                    .addPackage(new MainReactPackage())
                    .addPackage(new QtalkServiceReactPackage(mActivity))
                    .addPackage(new CookieManagerPackage())
                    .addPackage(new SvgPackage())
                    .addPackage(new RNI18nPackage())
                    .setUseDeveloperSupport(CommonConfig.isDebug)
                    .setInitialLifecycleState(LifecycleState.RESUMED);

            String localBundleFile = getLocalBundleFilePath(mActivity, bundleName);

            File file = new File(localBundleFile);
            if (file.exists()) {
                // load from cache
                is_ok = true;
                builder.setJSBundleFile(localBundleFile);
            } else {
//                 load from asset
                is_ok = false;
            }

            mReactInstanceManager = builder.build();


        } catch (Exception e) {
            is_ok = false;
        }

        return is_ok;
    }
 
Example 9
Source File: QtalkServiceRNViewInstanceManager.java    From imsdk-android with MIT License 5 votes vote down vote up
public static boolean buildBundle(Activity activity){
        boolean is_ok = false;

        try {
            ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
                    .setApplication(activity.getApplication())
                    .setJSMainModulePath("index.android")
                    .addPackage(new MainReactPackage())
                    .addPackage(new QtalkServiceReactPackage(activity))
                    .addPackage(new CookieManagerPackage())
                    .addPackage( new SvgPackage())
                    .addPackage(new RNI18nPackage())
                    .setUseDeveloperSupport(CommonConfig.isDebug)
                    .setInitialLifecycleState(LifecycleState.RESUMED);


            String localBundleFile = getLocalBundleFilePath(activity);

            File file = new File(localBundleFile);
            if (file.exists()) {
                // load from cache
                builder.setJSBundleFile(localBundleFile);
            } else {
//                 load from asset
                builder.setBundleAssetName(JS_BUNDLE_NAME);
            }

            mReactInstanceManager = builder.build();

            is_ok = true;
        }catch (Exception e){

        }

        return is_ok;
    }
 
Example 10
Source File: QTalkSearchRNViewInstanceManager.java    From imsdk-android with MIT License 5 votes vote down vote up
public static boolean buildBundle(Application application){
    boolean is_ok = false;

    try {
        ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
                .setApplication(application)
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .addPackage(new SearchReactPackage())
                .addPackage( new SvgPackage())
                .addPackage(new RNI18nPackage())
                .setUseDeveloperSupport(CommonConfig.isDebug)
                .setInitialLifecycleState(LifecycleState.RESUMED);

        String localBundleFile = getLocalBundleFilePath(application);

        File file = new File(localBundleFile);
        if (file.exists()) {
            // load from cache
            builder.setJSBundleFile(localBundleFile);
        } else {
            // load from asset
            builder.setBundleAssetName(JS_BUNDLE_NAME);
        }

        mReactInstanceManager = builder.build();

        is_ok = true;
    }catch (Exception e){

    }

    return is_ok;
}
 
Example 11
Source File: QTalkSearchRNViewOldInstanceManager.java    From imsdk-android with MIT License 5 votes vote down vote up
public static boolean buildBundle(Application application) {
    boolean is_ok = false;

    try {
        ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
                .setApplication(application)
                .setJSMainModulePath("index.android")
                .addPackage(new MainReactPackage())
                .addPackage(new SearchReactPackage())
                .addPackage(new SvgPackage())
                .addPackage(new RNI18nPackage())
                .setUseDeveloperSupport(CommonConfig.isDebug)
                .setInitialLifecycleState(LifecycleState.RESUMED);

        String localBundleFile = getLocalBundleFilePath(application);

        File file = new File(localBundleFile);
        if (file.exists()) {
            // load from cache
            builder.setJSBundleFile(localBundleFile);
        } else {
            // load from asset
            builder.setBundleAssetName(JS_BUNDLE_NAME);
        }

        mReactInstanceManager = builder.build();

        is_ok = true;
    } catch (Exception e) {

    }

    return is_ok;
}