要添加一个React本机组件,我在Activity-的onCreate()中使用它
ReactRootView mReactRootView = new ReactRootView(getActivity());
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getActivity().getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.BEFORE_RESUME)
.build();
mReactRootView.startReactApplication(mReactInstanceManager,
"MyReactNativeApp", null);
FrameLayout fl = (FrameLayout) fragmentView.findViewById(R.id.rct);
fl.addView(mReactRootView);
应该执行什么操作才能加载特定的react组件。例如,如果我需要在ReactRootView中加载<Carousel></Carousel>
组件,并且我需要在同一屏幕上加载另一个<Button></Button>
组件并从Java将props传递给组件的ReactRootView?