Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@ import com.facebook.react.uimanager.events.EventDispatcher

@OptIn(UnstableReactNativeAPI::class)
public interface UIManager : PerformanceCounter {
/** Registers a new root view. @Deprecated call startSurface instead */
/**
* Registers a new root view.
*
* @deprecated Use `ReactHost.createSurface(...)` and `ReactSurface.start()` instead.
*/
@UiThread
@ThreadConfined(ThreadConfined.UI)
@Deprecated("")
@Deprecated(
"This legacy surface API will be removed in a future release. " +
"Use ReactHost.createSurface(...) and ReactSurface.start() instead."
)
public fun <T : View> addRootView(rootView: T, initialProps: WritableMap?): Int

/** Registers a new root view with width and height. */
/**
* Registers a new root view with width and height.
*
* @deprecated Use `ReactHost.createSurface(...)` and `ReactSurface.start()` instead.
*/
@AnyThread
@Deprecated(
"This legacy surface API will be removed in a future release. " +
"Use ReactHost.createSurface(...) and ReactSurface.start() instead."
)
public fun <T : View?> startSurface(
rootView: T,
moduleName: String,
Expand All @@ -35,8 +50,14 @@ public interface UIManager : PerformanceCounter {
/**
* Stop a surface from running in JS and clears up native memory usage. Assumes that the native
* View hierarchy has already been cleaned up. Fabric-only.
*
* @deprecated Use `ReactSurface.stop()` instead.
*/
@AnyThread public fun stopSurface(surfaceId: Int)
@AnyThread
@Deprecated(
"This legacy surface API will be removed in a future release. Use ReactSurface.stop() instead."
)
public fun stopSurface(surfaceId: Int)

/**
* Updates the layout specs of the RootShadowNode based on the Measure specs received by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ public FabricUIManager(
mReactApplicationContext.registerComponentCallbacks(viewManagerRegistry);
}

/**
* @deprecated Use {@code ReactHost.createSurface(...)} and {@code ReactSurface.start()} instead.
*/
@Override
@UiThread
@ThreadConfined(UI)
Expand All @@ -271,7 +274,8 @@ public <T extends View> int addRootView(
ReactSoftExceptionLogger.logSoftException(
TAG,
new IllegalViewOperationException(
"Do not call addRootView in Fabric; it is unsupported. Call startSurface instead."));
"Do not call addRootView in Fabric; it is unsupported. Use ReactHost.createSurface(...)"
+ " and ReactSurface.start() instead."));

ReactRoot reactRootView = (ReactRoot) rootView;
final int rootTag = reactRootView.getRootViewTag();
Expand Down Expand Up @@ -341,6 +345,10 @@ public <T extends View> int addRootView(
return mBinding != null ? mBinding.getRelativeAncestorList(rootTag, childTag) : null;
}

/**
* @deprecated Use {@code ReactHost.createSurface(...)} and {@code ReactSurface.start()} instead.
*/
@Deprecated
@Override
@AnyThread
@ThreadConfined(ANY)
Expand Down Expand Up @@ -430,6 +438,10 @@ public void onRequestEventBeat() {
mEventDispatcher.dispatchAllEvents();
}

/**
* @deprecated Use {@code ReactSurface.stop()} instead.
*/
@Deprecated
@AnyThread
@ThreadConfined(ANY)
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class FakeUIManager : UIManager, UIBlockViewResolver {
error("Not yet implemented")
}

@Deprecated("")
override fun <T : View?> startSurface(
rootView: T,
moduleName: String,
Expand All @@ -44,6 +45,7 @@ class FakeUIManager : UIManager, UIBlockViewResolver {
error("Not yet implemented")
}

@Deprecated("")
override fun stopSurface(surfaceId: Int) {
error("Not yet implemented")
}
Expand Down
Loading