diff --git a/node_modules/react-native-nitro-modules/cpp/utils/NitroDefines.hpp b/node_modules/react-native-nitro-modules/cpp/utils/NitroDefines.hpp --- a/node_modules/react-native-nitro-modules/cpp/utils/NitroDefines.hpp +++ b/node_modules/react-native-nitro-modules/cpp/utils/NitroDefines.hpp @@ -31,6 +31,13 @@ #define _CXX_INTEROP_HAS_ATTRIBUTE(x) 0 #endif +// Helper to find out if this code is currently being compiled as part of a given clang module +#ifdef __building_module +#define NITRO_BUILDING_MODULE(module) __building_module(module) +#else +#define NITRO_BUILDING_MODULE(module) 0 +#endif + // Closed/Final Enums #if _CXX_INTEROP_HAS_ATTRIBUTE(enum_extensibility) // Enum is marked as closed/not extensible diff --git a/node_modules/react-native-nitro-modules/cpp/views/ReactProp.hpp b/node_modules/react-native-nitro-modules/cpp/views/ReactProp.hpp --- a/node_modules/react-native-nitro-modules/cpp/views/ReactProp.hpp +++ b/node_modules/react-native-nitro-modules/cpp/views/ReactProp.hpp @@ -4,6 +4,13 @@ #pragma once +#include "NitroDefines.hpp" + +// This header includes headers, which cannot be compiled as part of a +// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only +// be included textually, from C++. +#if !NITRO_BUILDING_MODULE(NitroModules) + #include "BorrowingReference.hpp" #include "IsFunctionProp.hpp" #include "JSIConverter.hpp" @@ -121,3 +128,5 @@ class ReactProp final { }; } // namespace margelo::nitro + +#endif diff --git a/node_modules/react-native-nitro-modules/cpp/views/ViewComponentDescriptor.hpp b/node_modules/react-native-nitro-modules/cpp/views/ViewComponentDescriptor.hpp --- a/node_modules/react-native-nitro-modules/cpp/views/ViewComponentDescriptor.hpp +++ b/node_modules/react-native-nitro-modules/cpp/views/ViewComponentDescriptor.hpp @@ -4,6 +4,13 @@ #pragma once +#include "NitroDefines.hpp" + +// This header includes headers, which cannot be compiled as part of a +// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only +// be included textually, from C++. +#if !NITRO_BUILDING_MODULE(NitroModules) + #include "RawPropsCompat.hpp" #include @@ -75,3 +82,5 @@ class ViewComponentDescriptor final : public react::ConcreteComponentDescriptor< }; } // namespace margelo::nitro + +#endif diff --git a/node_modules/react-native-nitro-modules/cpp/views/ViewPropsHolderState.hpp b/node_modules/react-native-nitro-modules/cpp/views/ViewPropsHolderState.hpp --- a/node_modules/react-native-nitro-modules/cpp/views/ViewPropsHolderState.hpp +++ b/node_modules/react-native-nitro-modules/cpp/views/ViewPropsHolderState.hpp @@ -4,6 +4,13 @@ #pragma once +#include "NitroDefines.hpp" + +// This header includes headers, which cannot be compiled as part of a +// clang module - so it is hidden from the Swift-facing `NitroModules` module and can only +// be included textually, from C++. +#if !NITRO_BUILDING_MODULE(NitroModules) + #include #include #include @@ -48,3 +55,5 @@ struct ViewPropsHolderState final { }; } // namespace margelo::nitro + +#endif