diff --git a/ios/RNIContextMenuButton/RNIContextMenuButton.h b/ios/RNIContextMenuButton/RNIContextMenuButton.h index 6b142bea..1efb6235 100644 --- a/ios/RNIContextMenuButton/RNIContextMenuButton.h +++ b/ios/RNIContextMenuButton/RNIContextMenuButton.h @@ -5,11 +5,9 @@ // Created by Dominic Go on 8/24/24. // -#if __has_include() -#import -#else -#import -#endif +#import "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseView.h) #if RCT_NEW_ARCH_ENABLED #import diff --git a/ios/RNIContextMenuButton/RNIContextMenuButton.mm b/ios/RNIContextMenuButton/RNIContextMenuButton.mm index 08707917..1aba1422 100644 --- a/ios/RNIContextMenuButton/RNIContextMenuButton.mm +++ b/ios/RNIContextMenuButton/RNIContextMenuButton.mm @@ -7,29 +7,16 @@ #import "RNIContextMenuButton.h" #import "../Swift.h" +#import "../RNIHeaderUtils.h" -#if __has_include() -#import -#import -#import -#import -#else -#import -#import -#import -#import -#endif +#import RNI_INCLUDE_HEADER(RNIContentViewParentDelegate.h) +#import RNI_INCLUDE_HEADER(UIApplication+RNIHelpers.h) +#import RNI_INCLUDE_HEADER(RNIObjcUtils.h) #if RCT_NEW_ARCH_ENABLED #include "RNIContextMenuButtonComponentDescriptor.h" - -#if __has_include() -#include -#include -#else -#include -#include -#endif +#import RNI_INCLUDE_HEADER(RNIBaseViewState.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewProps.h) #import #import diff --git a/ios/RNIContextMenuButton/RNIContextMenuButtonComponentDescriptor.h b/ios/RNIContextMenuButton/RNIContextMenuButtonComponentDescriptor.h index 7cf637e8..d8e05ff0 100644 --- a/ios/RNIContextMenuButton/RNIContextMenuButtonComponentDescriptor.h +++ b/ios/RNIContextMenuButton/RNIContextMenuButtonComponentDescriptor.h @@ -10,12 +10,9 @@ #include "RNIContextMenuButtonShadowNode.h" #include "RNIBaseViewComponentDescriptor.h" +#include "../RNIHeaderUtils.h" -#if __has_include() -#include -#else -#include -#endif +#import RNI_INCLUDE_HEADER(RNIBaseViewState.h) #include diff --git a/ios/RNIContextMenuButton/RNIContextMenuButtonShadowNode.h b/ios/RNIContextMenuButton/RNIContextMenuButtonShadowNode.h index d9ffbb6f..aac287f4 100644 --- a/ios/RNIContextMenuButton/RNIContextMenuButtonShadowNode.h +++ b/ios/RNIContextMenuButton/RNIContextMenuButtonShadowNode.h @@ -8,15 +8,11 @@ #if __cplusplus #pragma once -#if __has_include() -#include -#include -#include -#else -#include -#include -#include -#endif +#include "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseViewShadowNode.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewProps.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewEventEmitter.h) #include #include @@ -34,7 +30,7 @@ class JSI_EXPORT RNIContextMenuButtonShadowNode final : public: using RNIBaseViewShadowNode::RNIBaseViewShadowNode; - + static RNIBaseViewState initialStateData( const Props::Shared&r , // props const ShadowNodeFamily::Shared&, // family diff --git a/ios/RNIContextMenuButton/RNIContextMenuButtonViewManager.mm b/ios/RNIContextMenuButton/RNIContextMenuButtonViewManager.mm index 4b0ec1b7..405101f0 100644 --- a/ios/RNIContextMenuButton/RNIContextMenuButtonViewManager.mm +++ b/ios/RNIContextMenuButton/RNIContextMenuButtonViewManager.mm @@ -8,11 +8,9 @@ #import "RNIContextMenuButton.h" #import -#if __has_include() -#import -#else -#import -#endif +#import "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseViewUtils.h) #import "RCTBridge.h" #import diff --git a/ios/RNIContextMenuView/RNIContextMenuView.h b/ios/RNIContextMenuView/RNIContextMenuView.h index feb721a2..e84505c6 100644 --- a/ios/RNIContextMenuView/RNIContextMenuView.h +++ b/ios/RNIContextMenuView/RNIContextMenuView.h @@ -5,11 +5,9 @@ // Created by Dominic Go on 8/24/24. // -#if __has_include() -#import -#else -#import -#endif +#import "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseView.h) #if RCT_NEW_ARCH_ENABLED #import diff --git a/ios/RNIContextMenuView/RNIContextMenuView.mm b/ios/RNIContextMenuView/RNIContextMenuView.mm index 99d7f45d..8880a0fd 100644 --- a/ios/RNIContextMenuView/RNIContextMenuView.mm +++ b/ios/RNIContextMenuView/RNIContextMenuView.mm @@ -8,28 +8,22 @@ #import "RNIContextMenuView.h" #import "../Swift.h" -#if __has_include() -#import -#import -#import -#import -#else -#import -#import -#import -#import +#import "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseView.h) +#import RNI_INCLUDE_HEADER(RNIContentViewParentDelegate.h) +#import RNI_INCLUDE_HEADER(UIApplication+RNIHelpers.h) +#import RNI_INCLUDE_HEADER(RNIObjcUtils.h) + +#if RCT_NEW_ARCH_ENABLED +#import RNI_INCLUDE_HEADER(RNIBaseViewState.h) #endif #if RCT_NEW_ARCH_ENABLED #include "RNIContextMenuViewComponentDescriptor.h" -#if __has_include() -#include -#include -#else -#include -#include -#endif +#import RNI_INCLUDE_HEADER(RNIBaseViewState.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewProps.h) #import #import diff --git a/ios/RNIContextMenuView/RNIContextMenuViewComponentDescriptor.h b/ios/RNIContextMenuView/RNIContextMenuViewComponentDescriptor.h index 5aa27cd6..2fe842a9 100644 --- a/ios/RNIContextMenuView/RNIContextMenuViewComponentDescriptor.h +++ b/ios/RNIContextMenuView/RNIContextMenuViewComponentDescriptor.h @@ -29,7 +29,7 @@ class RNIContextMenuViewComponentDescriptor final : public RNIBaseViewComponentD RNIContextMenuViewShadowNode, RNIContextMenuViewComponentName > { - + public: using RNIBaseViewComponentDescriptor::RNIBaseViewComponentDescriptor; }; diff --git a/ios/RNIContextMenuView/RNIContextMenuViewManager.mm b/ios/RNIContextMenuView/RNIContextMenuViewManager.mm index e10fe025..eac9da0a 100644 --- a/ios/RNIContextMenuView/RNIContextMenuViewManager.mm +++ b/ios/RNIContextMenuView/RNIContextMenuViewManager.mm @@ -8,11 +8,9 @@ #import "RNIContextMenuView.h" #import -#if __has_include() -#import -#else -#import -#endif +#import "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseViewUtils.h) #import "RCTBridge.h" #import diff --git a/ios/RNIContextMenuView/RNIContextMenuViewShadowNode.h b/ios/RNIContextMenuView/RNIContextMenuViewShadowNode.h index d0a0106f..c91e6ba6 100644 --- a/ios/RNIContextMenuView/RNIContextMenuViewShadowNode.h +++ b/ios/RNIContextMenuView/RNIContextMenuViewShadowNode.h @@ -8,15 +8,11 @@ #if __cplusplus #pragma once -#if __has_include() -#include -#include -#include -#else -#include -#include -#include -#endif +#include "../RNIHeaderUtils.h" + +#import RNI_INCLUDE_HEADER(RNIBaseViewShadowNode.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewProps.h) +#import RNI_INCLUDE_HEADER(RNIBaseViewEventEmitter.h) #include #include @@ -34,7 +30,7 @@ class JSI_EXPORT RNIContextMenuViewShadowNode final : public: using RNIBaseViewShadowNode::RNIBaseViewShadowNode; - + static RNIBaseViewState initialStateData( const Props::Shared&r , // props const ShadowNodeFamily::Shared&, // family diff --git a/ios/RNIHeaderUtils.h b/ios/RNIHeaderUtils.h new file mode 100644 index 00000000..66b12192 --- /dev/null +++ b/ios/RNIHeaderUtils.h @@ -0,0 +1,7 @@ +#pragma once + +#if __has_include() + #define RNI_INCLUDE_HEADER(header) +#else + #define RNI_INCLUDE_HEADER(header) +#endif diff --git a/ios/Swift.h b/ios/Swift.h index f9814ee4..c4f38791 100644 --- a/ios/Swift.h +++ b/ios/Swift.h @@ -4,10 +4,6 @@ // // Created by Dominic Go on 8/24/24. // - -// When `use_frameworks!` is used, the generated Swift header is inside -// the module. -// Otherwise, it's available only locally with double-quoted imports. #if __has_include() #import diff --git a/react-native-ios-context-menu.podspec b/react-native-ios-context-menu.podspec index 8f22bb29..9df98bf7 100644 --- a/react-native-ios-context-menu.podspec +++ b/react-native-ios-context-menu.podspec @@ -68,7 +68,7 @@ Pod::Spec.new do |s| '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"', '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-context-menu/Swift Compatibility Header"', - + #'"$(PODS_ROOT)/Headers/Private/react-native-ios-utilities"', #'"$(PODS_ROOT)/Headers/Public/react-native-ios-utilities"', @@ -76,7 +76,7 @@ Pod::Spec.new do |s| '"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"', '"$(PODS_ROOT)/Headers/Private/Yoga"', ] - + if fabric_enabled && ENV['USE_FRAMEWORKS'] user_header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\"" user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"" @@ -91,7 +91,7 @@ Pod::Spec.new do |s| "HEADER_SEARCH_PATHS" => user_header_search_paths, } - # s.xcconfig = { + # s.xcconfig = { # 'HEADER_SEARCH_PATHS' => [ # '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', # '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"', @@ -138,5 +138,5 @@ Pod::Spec.new do |s| s.exclude_files = exclude_files s.compiler_flags = compiler_flags - s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h'] + s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h', 'ios/**/RNIHeaderUtils.h'] end