From 0530fe80102962dc0ee29a0a7056bddaa0f60bd2 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Tue, 26 Dec 2023 10:14:05 -0800 Subject: [PATCH] BridgelessUIManager: Finish createView, updateView, setChildren, manageChildren (#42067) Summary: These methods should not be implemented in the new architecture. The **only** code that called these UIManagerModule methods was the paper renderer. And the New Architecture should instead use the Fabric renderer. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D52345416 --- .../ReactNative/BridgelessUIManager.js | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js index e1bf88f409335d..eb226f017026e5 100644 --- a/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js +++ b/packages/react-native/Libraries/ReactNative/BridgelessUIManager.js @@ -97,6 +97,38 @@ const UIManagerJSOverridenAPIs = { }, }; +/** + * Leave Unimplemented: The only thing that called these methods was the paper renderer. + * In OSS, the New Architecture will just use the Fabric renderer, which uses + * different APIs. + */ +const UIManagerJSUnusedAPIs = { + createView: ( + reactTag: ?number, + viewName: string, + rootTag: RootTag, + props: Object, + ): void => { + raiseSoftError('createView'); + }, + updateView: (reactTag: number, viewName: string, props: Object): void => { + raiseSoftError('updateView'); + }, + setChildren: (containerTag: ?number, reactTags: Array): void => { + raiseSoftError('setChildren'); + }, + manageChildren: ( + containerTag: ?number, + moveFromIndices: Array, + moveToIndices: Array, + addChildReactTags: Array, + addAtIndices: Array, + removeAtIndices: Array, + ): void => { + raiseSoftError('manageChildren'); + }, +}; + const UIManagerJSPlatformAPIs = Platform.select({ android: { getConstantsForViewManager: (viewManagerName: string): Object => { @@ -144,6 +176,7 @@ const UIManagerJSPlatformAPIs = Platform.select({ const UIManagerJS: UIManagerJSInterface & {[string]: any} = { ...UIManagerJSOverridenAPIs, ...UIManagerJSPlatformAPIs, + ...UIManagerJSUnusedAPIs, getViewManagerConfig: (viewManagerName: string): mixed => { if (getUIManagerConstants) { return getUIManagerConstantsCache()[viewManagerName]; @@ -166,17 +199,6 @@ const UIManagerJS: UIManagerJSInterface & {[string]: any} = { return null; } }, - createView: ( - reactTag: ?number, - viewName: string, - rootTag: RootTag, - props: Object, - ): void => { - raiseSoftError('createView'); - }, - updateView: (reactTag: number, viewName: string, props: Object): void => { - raiseSoftError('updateView'); - }, findSubviewIn: ( reactTag: ?number, point: Array, @@ -219,19 +241,6 @@ const UIManagerJS: UIManagerJSInterface & {[string]: any} = { ): void => { raiseSoftError('replaceExistingNonRootView'); }, - setChildren: (containerTag: ?number, reactTags: Array): void => { - raiseSoftError('setChildren'); - }, - manageChildren: ( - containerTag: ?number, - moveFromIndices: Array, - moveToIndices: Array, - addChildReactTags: Array, - addAtIndices: Array, - removeAtIndices: Array, - ): void => { - raiseSoftError('manageChildren'); - }, }; if (getUIManagerConstants) {