diff --git a/Libraries/NativeComponent/NativeComponentRegistry.js b/Libraries/NativeComponent/NativeComponentRegistry.js index 92db800de55..e56021877f0 100644 --- a/Libraries/NativeComponent/NativeComponentRegistry.js +++ b/Libraries/NativeComponent/NativeComponentRegistry.js @@ -152,22 +152,3 @@ export function unstable_hasStaticViewConfig(name: string): boolean { }; return !native; } - -/** - * Unstable API. Do not use! - * - * This method returns if the component with name received as a parameter - * is registed in the native platform. - */ -export function unstable_hasComponent(name: string): boolean { - let hasNativeComponent = componentNameToExists.get(name); - if (hasNativeComponent == null) { - if (global.__nativeComponentRegistry__hasComponent) { - hasNativeComponent = global.__nativeComponentRegistry__hasComponent(name); - componentNameToExists.set(name, hasNativeComponent); - } else { - throw `unstable_hasComponent('${name}'): Global function is not registered`; - } - } - return hasNativeComponent; -} diff --git a/Libraries/NativeComponent/NativeComponentRegistryUnstable.js b/Libraries/NativeComponent/NativeComponentRegistryUnstable.js new file mode 100644 index 00000000000..cebacfc033b --- /dev/null +++ b/Libraries/NativeComponent/NativeComponentRegistryUnstable.js @@ -0,0 +1,27 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +let componentNameToExists: Map = new Map(); + +/** + * Unstable API. Do not use! + * + * This method returns if the component with name received as a parameter + * is registed in the native platform. + */ +export function unstable_hasComponent(name: string): boolean { + let hasNativeComponent = componentNameToExists.get(name); + if (hasNativeComponent == null) { + if (global.__nativeComponentRegistry__hasComponent) { + hasNativeComponent = global.__nativeComponentRegistry__hasComponent(name); + componentNameToExists.set(name, hasNativeComponent); + } else { + throw `unstable_hasComponent('${name}'): Global function is not registered`; + } + } + return hasNativeComponent; +}