diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactSurface.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactSurface.java index a65673d8209ebe..1bac3bb52c916c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactSurface.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactSurface.java @@ -137,7 +137,8 @@ public SurfaceHandler getSurfaceHandler() { return mSurfaceView.get(); } - public Task prerender() { + @Override + public TaskInterface prerender() { ReactHost host = mReactHost.get(); if (host == null) { return Task.forError( @@ -164,7 +165,8 @@ public TaskInterface start() { return host.startSurface(this); } - public Task stop() { + @Override + public TaskInterface stop() { ReactHost host = mReactHost.get(); if (host == null) { return Task.forError( diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/interfaces/ReactSurfaceInterface.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/interfaces/ReactSurfaceInterface.kt index a045b02754f5bc..c10f4ebb85488d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/interfaces/ReactSurfaceInterface.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/interfaces/ReactSurfaceInterface.kt @@ -14,9 +14,15 @@ interface ReactSurfaceInterface { // the API of this interface will be completed as we analyze and refactor API of ReactSurface, // ReactRootView, etc. + // Prerender this surface + fun prerender(): TaskInterface + // Start running this surface fun start(): TaskInterface + // Stop running this surface + fun stop(): TaskInterface + // Get React root view of this surface fun getView(): ViewGroup? } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactSurfaceTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactSurfaceTest.java index 70ea7531537ebb..dbf0554e1a37fe 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactSurfaceTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactSurfaceTest.java @@ -77,7 +77,7 @@ public void testAttachThrowExeption() { @Test public void testPrerender() throws InterruptedException { mReactSurface.attach(mReactHost); - Task task = mReactSurface.prerender(); + Task task = (Task) mReactSurface.prerender(); task.waitForCompletion(); verify(mReactHost).prerenderSurface(mReactSurface); @@ -102,7 +102,7 @@ public void testStop() throws InterruptedException { Task task = (Task) mReactSurface.start(); task.waitForCompletion(); - task = mReactSurface.stop(); + task = (Task) mReactSurface.stop(); task.waitForCompletion(); verify(mReactHost).stopSurface(mReactSurface); @@ -152,7 +152,8 @@ public void testStartStopHandlerCalls() throws InterruptedException { assertThat(mReactSurface.isRunning()).isTrue(); - mReactSurface.stop().waitForCompletion(); + task = (Task) mReactSurface.stop(); + task.waitForCompletion(); assertThat(mReactSurface.isRunning()).isFalse(); }