Skip to content

Commit 1b3cd13

Browse files
javachefacebook-github-bot
authored andcommitted
Make FabricUIManager's Binding an interface
Summary: Changelog: [Internal] Differential Revision: D44340265 fbshipit-source-id: f6053c93c892e5ac1d621539dfc4ee4029d977c9
1 parent e0f8113 commit 1b3cd13

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
@DoNotStrip
2424
@SuppressLint("MissingNativeLoadLibrary")
25-
public class Binding {
25+
public class Binding implements IBinding {
2626

2727
static {
2828
FabricSoLoader.staticInit();
@@ -45,9 +45,11 @@ private native void installFabricUIManager(
4545
ComponentFactory componentsRegistry,
4646
Object reactNativeConfig);
4747

48+
@Override
4849
public native void startSurface(
4950
int surfaceId, @NonNull String moduleName, @NonNull NativeMap initialProps);
5051

52+
@Override
5153
public native void startSurfaceWithConstraints(
5254
int surfaceId,
5355
String moduleName,
@@ -61,12 +63,16 @@ public native void startSurfaceWithConstraints(
6163
boolean isRTL,
6264
boolean doLeftAndRightSwapInRTL);
6365

66+
@Override
6467
public native void renderTemplateToSurface(int surfaceId, String uiTemplate);
6568

69+
@Override
6670
public native void stopSurface(int surfaceId);
6771

72+
@Override
6873
public native void setPixelDensity(float pointScaleFactor);
6974

75+
@Override
7076
public native void setConstraints(
7177
int surfaceId,
7278
float minWidth,

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void onFabricCommitEnd(DevToolsReactPerfLogger.FabricCommitPoint commitPo
159159
FabricSoLoader.staticInit();
160160
}
161161

162-
@Nullable private Binding mBinding;
162+
@Nullable private IBinding mBinding;
163163
@NonNull private final ReactApplicationContext mReactApplicationContext;
164164
@NonNull private final MountingManager mMountingManager;
165165
@NonNull private final EventDispatcher mEventDispatcher;
@@ -826,7 +826,7 @@ public void run() {
826826
}
827827
}
828828

829-
public void setBinding(Binding binding) {
829+
public void setBinding(IBinding binding) {
830830
mBinding = binding;
831831
}
832832

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.fabric;
9+
10+
import androidx.annotation.NonNull;
11+
import com.facebook.react.bridge.NativeMap;
12+
import com.facebook.react.bridge.ReadableNativeMap;
13+
import com.facebook.react.bridge.RuntimeExecutor;
14+
import com.facebook.react.bridge.RuntimeScheduler;
15+
import com.facebook.react.fabric.events.EventBeatManager;
16+
import com.facebook.react.fabric.events.EventEmitterWrapper;
17+
18+
public interface IBinding {
19+
20+
public void startSurface(
21+
int surfaceId, @NonNull String moduleName, @NonNull NativeMap initialProps);
22+
23+
public void startSurfaceWithConstraints(
24+
int surfaceId,
25+
String moduleName,
26+
NativeMap initialProps,
27+
float minWidth,
28+
float maxWidth,
29+
float minHeight,
30+
float maxHeight,
31+
float offsetX,
32+
float offsetY,
33+
boolean isRTL,
34+
boolean doLeftAndRightSwapInRTL);
35+
36+
public void renderTemplateToSurface(int surfaceId, String uiTemplate);
37+
38+
public void stopSurface(int surfaceId);
39+
40+
public void setPixelDensity(float pointScaleFactor);
41+
42+
public void setConstraints(
43+
int surfaceId,
44+
float minWidth,
45+
float maxWidth,
46+
float minHeight,
47+
float maxHeight,
48+
float offsetX,
49+
float offsetY,
50+
boolean isRTL,
51+
boolean doLeftAndRightSwapInRTL);
52+
53+
public void driveCxxAnimations();
54+
55+
public ReadableNativeMap getInspectorDataForInstance(EventEmitterWrapper eventEmitterWrapper);
56+
57+
public void register(
58+
@NonNull RuntimeExecutor runtimeExecutor,
59+
@NonNull RuntimeScheduler runtimeScheduler,
60+
@NonNull FabricUIManager fabricUIManager,
61+
@NonNull EventBeatManager eventBeatManager,
62+
@NonNull ComponentFactory componentFactory,
63+
@NonNull ReactNativeConfig reactNativeConfig);
64+
65+
public void unregister();
66+
67+
public void registerSurface(SurfaceHandlerBinding surfaceHandler);
68+
69+
public void unregisterSurface(SurfaceHandlerBinding surfaceHandler);
70+
}

0 commit comments

Comments
 (0)