|
9 | 9 |
|
10 | 10 | import static com.facebook.infer.annotation.ThreadConfined.ANY; |
11 | 11 | import static com.facebook.infer.annotation.ThreadConfined.UI; |
12 | | -import static com.facebook.react.fabric.mounting.LayoutMetricsConversions.getMaxSize; |
13 | | -import static com.facebook.react.fabric.mounting.LayoutMetricsConversions.getMinSize; |
14 | 12 | import static com.facebook.react.fabric.mounting.LayoutMetricsConversions.getYogaMeasureMode; |
15 | 13 | import static com.facebook.react.fabric.mounting.LayoutMetricsConversions.getYogaSize; |
16 | 14 | import static com.facebook.react.uimanager.UIManagerHelper.PADDING_BOTTOM_INDEX; |
|
20 | 18 |
|
21 | 19 | import android.annotation.SuppressLint; |
22 | 20 | import android.content.Context; |
23 | | -import android.graphics.Point; |
24 | 21 | import android.os.SystemClock; |
25 | 22 | import android.view.View; |
26 | 23 | import android.view.accessibility.AccessibilityEvent; |
|
38 | 35 | import com.facebook.react.bridge.GuardedRunnable; |
39 | 36 | import com.facebook.react.bridge.LifecycleEventListener; |
40 | 37 | import com.facebook.react.bridge.NativeArray; |
41 | | -import com.facebook.react.bridge.NativeMap; |
42 | 38 | import com.facebook.react.bridge.ReactApplicationContext; |
43 | 39 | import com.facebook.react.bridge.ReactContext; |
44 | 40 | import com.facebook.react.bridge.ReactMarker; |
|
73 | 69 | import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlags; |
74 | 70 | import com.facebook.react.internal.interop.InteropEventEmitter; |
75 | 71 | import com.facebook.react.modules.core.ReactChoreographer; |
76 | | -import com.facebook.react.modules.i18nmanager.I18nUtil; |
77 | 72 | import com.facebook.react.uimanager.DisplayMetricsHolder; |
78 | 73 | import com.facebook.react.uimanager.GuardedFrameCallback; |
79 | | -import com.facebook.react.uimanager.IllegalViewOperationException; |
80 | 74 | import com.facebook.react.uimanager.PixelUtil; |
81 | 75 | import com.facebook.react.uimanager.ReactRoot; |
82 | 76 | import com.facebook.react.uimanager.ReactRootViewTagGenerator; |
83 | | -import com.facebook.react.uimanager.RootViewUtil; |
84 | 77 | import com.facebook.react.uimanager.StateWrapper; |
85 | 78 | import com.facebook.react.uimanager.ThemedReactContext; |
86 | 79 | import com.facebook.react.uimanager.UIManagerHelper; |
@@ -271,26 +264,7 @@ public FabricUIManager( |
271 | 264 | @Deprecated |
272 | 265 | public <T extends View> int addRootView( |
273 | 266 | final T rootView, final @Nullable WritableMap initialProps) { |
274 | | - ReactSoftExceptionLogger.logSoftException( |
275 | | - TAG, |
276 | | - new IllegalViewOperationException( |
277 | | - "Do not call addRootView in Fabric; it is unsupported. Use ReactHost.createSurface(...)" |
278 | | - + " and ReactSurface.start() instead.")); |
279 | | - |
280 | | - ReactRoot reactRootView = (ReactRoot) rootView; |
281 | | - final int rootTag = reactRootView.getRootViewTag(); |
282 | | - |
283 | | - ThemedReactContext reactContext = |
284 | | - new ThemedReactContext( |
285 | | - mReactApplicationContext, rootView.getContext(), reactRootView.getSurfaceID(), rootTag); |
286 | | - mMountingManager.startSurface(rootTag, reactContext, rootView); |
287 | | - String moduleName = reactRootView.getJSModuleName(); |
288 | | - if (ReactNativeFeatureFlags.enableFabricLogs()) { |
289 | | - FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); |
290 | | - } |
291 | | - Assertions.assertNotNull(mBinding, "Binding in FabricUIManager is null"); |
292 | | - mBinding.startSurface(rootTag, moduleName, (NativeMap) initialProps); |
293 | | - return rootTag; |
| 267 | + throw new UnsupportedOperationException("FabricUIManager.addRootView is unsupported."); |
294 | 268 | } |
295 | 269 |
|
296 | 270 | /** |
@@ -358,36 +332,8 @@ public <T extends View> int startSurface( |
358 | 332 | final @Nullable WritableMap initialProps, |
359 | 333 | int widthMeasureSpec, |
360 | 334 | int heightMeasureSpec) { |
361 | | - final int rootTag = ((ReactRoot) rootView).getRootViewTag(); |
362 | | - Context context = rootView.getContext(); |
363 | | - ThemedReactContext reactContext = |
364 | | - new ThemedReactContext(mReactApplicationContext, context, moduleName, rootTag); |
365 | | - if (ReactNativeFeatureFlags.enableFabricLogs()) { |
366 | | - FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); |
367 | | - } |
368 | | - mMountingManager.startSurface(rootTag, reactContext, rootView); |
369 | | - |
370 | | - // If startSurface is executed in the UIThread then, it uses the ViewportOffset from the View, |
371 | | - // Otherwise Fabric relies on calling {@link Binding#setConstraints} method to update the |
372 | | - // ViewportOffset during measurement or onLayout. |
373 | | - @SuppressLint("WrongThread") |
374 | | - Point viewportOffset = |
375 | | - UiThreadUtil.isOnUiThread() ? RootViewUtil.getViewportOffset(rootView) : new Point(0, 0); |
376 | | - |
377 | | - Assertions.assertNotNull(mBinding, "Binding in FabricUIManager is null"); |
378 | | - mBinding.startSurfaceWithConstraints( |
379 | | - rootTag, |
380 | | - moduleName, |
381 | | - (NativeMap) initialProps, |
382 | | - getMinSize(widthMeasureSpec), |
383 | | - getMaxSize(widthMeasureSpec), |
384 | | - getMinSize(heightMeasureSpec), |
385 | | - getMaxSize(heightMeasureSpec), |
386 | | - viewportOffset.x, |
387 | | - viewportOffset.y, |
388 | | - I18nUtil.getInstance().isRTL(context), |
389 | | - I18nUtil.getInstance().doLeftAndRightSwapInRTL(context)); |
390 | | - return rootTag; |
| 335 | + throw new UnsupportedOperationException( |
| 336 | + "FabricUIManager.startSurface(View, ...) is unsupported."); |
391 | 337 | } |
392 | 338 |
|
393 | 339 | public void startSurface( |
@@ -446,14 +392,7 @@ public void onRequestEventBeat() { |
446 | 392 | @ThreadConfined(ANY) |
447 | 393 | @Override |
448 | 394 | public void stopSurface(final int surfaceID) { |
449 | | - // Mark surfaceId as dead, stop executing mounting instructions |
450 | | - mMountingManager.stopSurface(surfaceID); |
451 | | - |
452 | | - // Communicate stopSurface to Cxx - causes an empty ShadowTree to be committed, |
453 | | - // but all mounting instructions will be ignored because stopSurface was called |
454 | | - // on the MountingManager |
455 | | - Assertions.assertNotNull(mBinding, "Binding in FabricUIManager is null"); |
456 | | - mBinding.stopSurface(surfaceID); |
| 395 | + throw new UnsupportedOperationException("FabricUIManager.stopSurface(int) is unsupported."); |
457 | 396 | } |
458 | 397 |
|
459 | 398 | @Override |
@@ -1130,43 +1069,7 @@ public void updateRootLayoutSpecs( |
1130 | 1069 | final int widthMeasureSpec, |
1131 | 1070 | final int heightMeasureSpec, |
1132 | 1071 | final int offsetX, |
1133 | | - final int offsetY) { |
1134 | | - |
1135 | | - if (ReactNativeFeatureFlags.enableFabricLogs()) { |
1136 | | - FLog.d(TAG, "Updating Root Layout Specs for [%d]", surfaceId); |
1137 | | - } |
1138 | | - |
1139 | | - SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManager(surfaceId); |
1140 | | - |
1141 | | - // TODO T83615646: make this a hard-crash in the future. |
1142 | | - if (surfaceMountingManager == null) { |
1143 | | - ReactSoftExceptionLogger.logSoftException( |
1144 | | - TAG, |
1145 | | - new IllegalViewOperationException( |
1146 | | - "Cannot updateRootLayoutSpecs on surfaceId that does not exist: " + surfaceId)); |
1147 | | - return; |
1148 | | - } |
1149 | | - |
1150 | | - Context context = surfaceMountingManager.getContext(); |
1151 | | - boolean isRTL = false; |
1152 | | - boolean doLeftAndRightSwapInRTL = false; |
1153 | | - if (context != null) { |
1154 | | - isRTL = I18nUtil.getInstance().isRTL(context); |
1155 | | - doLeftAndRightSwapInRTL = I18nUtil.getInstance().doLeftAndRightSwapInRTL(context); |
1156 | | - } |
1157 | | - |
1158 | | - Assertions.assertNotNull(mBinding, "Binding in FabricUIManager is null"); |
1159 | | - mBinding.setConstraints( |
1160 | | - surfaceId, |
1161 | | - getMinSize(widthMeasureSpec), |
1162 | | - getMaxSize(widthMeasureSpec), |
1163 | | - getMinSize(heightMeasureSpec), |
1164 | | - getMaxSize(heightMeasureSpec), |
1165 | | - offsetX, |
1166 | | - offsetY, |
1167 | | - isRTL, |
1168 | | - doLeftAndRightSwapInRTL); |
1169 | | - } |
| 1072 | + final int offsetY) {} |
1170 | 1073 |
|
1171 | 1074 | @Override |
1172 | 1075 | public @Nullable View resolveView(int reactTag) { |
|
0 commit comments