From 15ef4d0f932435789c6086a75a146e21df343347 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Dall'Agnol Date: Fri, 26 Aug 2022 10:35:53 -0700 Subject: [PATCH] feat: Add support for Modal on iOS when Fabric is enabled (#34487) Summary: While working on a fix for https://github.com/facebook/react-native/issues/29974 (I have a draft for that already (https://github.com/gabrieldonadel/react-native/pull/16), just waiting for https://github.com/facebook/react-native/pull/34406 to get merged) I noticed that the `KeyboardAvoidingView` tests on RNTester on iOS were not working with Fabric enabled because the `ModalHostView` component was still not implemented. Upon some more investigation, I found this code suggestion from Milker90 (https://github.com/facebook/react-native/issues/33652#issuecomment-1214675790) that enables the Modal component on iOS when Fabric is enabled. Closes https://github.com/facebook/react-native/issues/33652 ## Changelog [iOS] [Added] - Add support for Modal on iOS when Fabric is enabled Pull Request resolved: https://github.com/facebook/react-native/pull/34487 Test Plan: 1. With Fabric enabled open the RNTester app and navigate to the Modal page 2. Test the `Modal` component through the sections changing props https://user-images.githubusercontent.com/11707729/186289099-5223907d-b300-46bf-bfde-73259c29d544.mov Reviewed By: christophpurrer Differential Revision: D38981895 Pulled By: cipolleschi fbshipit-source-id: cd493a8d2035900da2576323bc112e2565df4834 --- .../Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h | 1 + .../Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm | 1 + 2 files changed, 2 insertions(+) diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h index a2cc0aa7567e90..0cc6b210ba14c8 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h @@ -42,6 +42,7 @@ Class RCTTextInputCls(void) __attribute__((used)); Class RCTInputAccessoryCls(void) __attribute__((used)); Class RCTViewCls(void) __attribute__((used)); Class RCTImageCls(void) __attribute__((used)); +Class RCTModalHostViewCls(void) __attribute__((used)); #ifdef __cplusplus } diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm index 84cbe8d55b3a20..6318933170134f 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm @@ -30,6 +30,7 @@ {"InputAccessoryView", RCTInputAccessoryCls}, {"View", RCTViewCls}, {"Image", RCTImageCls}, + {"ModalHostView", RCTModalHostViewCls}, }; auto p = sFabricComponentsClassMap.find(name);