Clean up Fabric startSurface API used in Venice
Summary: Update FabricUIManager methods for `SurfaceHandler` to start usual rendering or prerendering based on presence of the view instead of using two methods with same logic. Changelog: [Internal] Reviewed By: sshic Differential Revision: D30346502 fbshipit-source-id: 297f2b4a16dc7af7c36379252bd73e6dc953ff59
This commit is contained in:
Родитель
06e31c748f
Коммит
22f81b203f
|
@ -294,14 +294,28 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
|||
return rootTag;
|
||||
}
|
||||
|
||||
public void startSurface(final SurfaceHandler surfaceHandler) {
|
||||
int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
|
||||
mMountingManager.startSurface(rootTag);
|
||||
public void startSurface(final SurfaceHandler surfaceHandler, final @Nullable View rootView) {
|
||||
final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
|
||||
|
||||
startSurfaceWithId(surfaceHandler, rootTag, false);
|
||||
if (rootView == null) {
|
||||
mMountingManager.startSurface(rootTag);
|
||||
} else {
|
||||
Context context = rootView.getContext();
|
||||
ThemedReactContext reactContext =
|
||||
new ThemedReactContext(
|
||||
mReactApplicationContext, context, surfaceHandler.getModuleName(), rootTag);
|
||||
mMountingManager.startSurface(rootTag, rootView, reactContext);
|
||||
}
|
||||
|
||||
surfaceHandler.setSurfaceId(rootTag);
|
||||
if (surfaceHandler instanceof SurfaceHandlerBinding) {
|
||||
mBinding.registerSurface((SurfaceHandlerBinding) surfaceHandler);
|
||||
}
|
||||
surfaceHandler.setMountable(rootView != null);
|
||||
surfaceHandler.start();
|
||||
}
|
||||
|
||||
public void attachRootView(final View rootView, final SurfaceHandler surfaceHandler) {
|
||||
public void attachRootView(final SurfaceHandler surfaceHandler, final View rootView) {
|
||||
ThemedReactContext reactContext =
|
||||
new ThemedReactContext(
|
||||
mReactApplicationContext,
|
||||
|
@ -313,27 +327,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
|||
surfaceHandler.setMountable(true);
|
||||
}
|
||||
|
||||
public void startSurfaceWithView(final View rootView, final SurfaceHandler surfaceHandler) {
|
||||
final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
|
||||
|
||||
Context context = rootView.getContext();
|
||||
ThemedReactContext reactContext =
|
||||
new ThemedReactContext(
|
||||
mReactApplicationContext, context, surfaceHandler.getModuleName(), rootTag);
|
||||
mMountingManager.startSurface(rootTag, rootView, reactContext);
|
||||
|
||||
startSurfaceWithId(surfaceHandler, rootTag, true);
|
||||
}
|
||||
|
||||
private void startSurfaceWithId(SurfaceHandler surfaceHandler, int rootTag, boolean isMountable) {
|
||||
surfaceHandler.setSurfaceId(rootTag);
|
||||
if (surfaceHandler instanceof SurfaceHandlerBinding) {
|
||||
mBinding.registerSurface((SurfaceHandlerBinding) surfaceHandler);
|
||||
}
|
||||
surfaceHandler.setMountable(isMountable);
|
||||
surfaceHandler.start();
|
||||
}
|
||||
|
||||
public void stopSurface(final SurfaceHandler surfaceHandler) {
|
||||
if (!surfaceHandler.isRunning()) {
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
|
|
Загрузка…
Ссылка в новой задаче