From de78906391935f46e84a198f5f5d64fc40826c44 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Wed, 1 Apr 2026 00:42:34 -0700 Subject: [PATCH] Register VirtualView component (#56289) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56289 Changelog: [GENERAL][FIXED] Link VirtualView component I saw D98039999 and I wanted to check how the new components are working in OSS, and currently they don't. VirtualView component isn't correctly linked in OSS. This diff addresses that. Note that VirtualView in OSS requires `babel-plugin-transform-flow-enums` which is not part of the default template. Reviewed By: CalixTang Differential Revision: D98887952 fbshipit-source-id: f06ec9d4581c6fa3f2185641cb4b9f7acb8f557e --- .../Mounting/ComponentViews/RCTFabricComponentsPlugins.h | 1 + .../Mounting/ComponentViews/RCTFabricComponentsPlugins.mm | 1 + .../main/java/com/facebook/react/shell/MainReactPackage.kt | 4 ++++ .../react-native/ReactCommon/React-FabricComponents.podspec | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h b/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h index 027b8d2f696..6b8a6ff6d6d 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h @@ -40,6 +40,7 @@ Class RCTSwitchCls(void) __attribute__((used)); Class RCTTextInputCls(void) __attribute__((used)); Class RCTUnimplementedNativeViewCls(void) __attribute__((used)); Class RCTViewCls(void) __attribute__((used)); +Class VirtualViewCls(void) __attribute__((used)); Class RCTImageCls(void) __attribute__((used)); Class RCTModalHostViewCls(void) __attribute__((used)); diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm index 82fff92ff64..442c2e6e396 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm @@ -29,6 +29,7 @@ Class RCTFabricComponentsProvider(const char *name) { {"TextInput", RCTTextInputCls}, {"UnimplementedNativeView", RCTUnimplementedNativeViewCls}, {"View", RCTViewCls}, + {"VirtualView", VirtualViewCls}, {"Image", RCTImageCls}, {"ModalHostView", RCTModalHostViewCls}, }; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt index b3baad46a9a..be24b4d6209 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt @@ -63,6 +63,7 @@ import com.facebook.react.views.text.SelectableTextViewManager import com.facebook.react.views.textinput.ReactTextInputManager import com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager import com.facebook.react.views.view.ReactViewManager +import com.facebook.react.views.virtual.view.ReactVirtualViewManager /** * Package defining basic modules and view managers. @@ -155,6 +156,7 @@ constructor(private val config: MainPackageConfig? = null) : else ReactTextViewManager(), SelectableTextViewManager(), ReactViewManager(), + ReactVirtualViewManager(), ReactUnimplementedViewManager(), ) @@ -199,6 +201,8 @@ constructor(private val config: MainPackageConfig? = null) : SelectableTextViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { SelectableTextViewManager() }, ReactViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactViewManager() }, + ReactVirtualViewManager.REACT_CLASS to + ModuleSpec.viewManagerSpec { ReactVirtualViewManager() }, ReactUnimplementedViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactUnimplementedViewManager() }, ) diff --git a/packages/react-native/ReactCommon/React-FabricComponents.podspec b/packages/react-native/ReactCommon/React-FabricComponents.podspec index dda0797fc76..500dd3d8e31 100644 --- a/packages/react-native/ReactCommon/React-FabricComponents.podspec +++ b/packages/react-native/ReactCommon/React-FabricComponents.podspec @@ -148,7 +148,7 @@ Pod::Spec.new do |s| end ss.subspec "virtualview" do |sss| - sss.source_files = "react/renderer/components/virtualview/**/*.{m,mm,cpp,h}" + sss.source_files = podspec_sources("react/renderer/components/virtualview/**/*.{m,mm,cpp,h}", "react/renderer/components/virtualview/**/*.h") sss.exclude_files = "react/renderer/components/virtualview/tests" sss.header_dir = "react/renderer/components/virtualview" end