Skip to content

Commit d79d12a

Browse files
committed
fix(#106): FBReactNativeSpec_visionOS.h not found
1 parent 2a2bf47 commit d79d12a

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

packages/react-native/Libraries/XR/RCTXRModule.mm

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
#import <React/RCTXRModule.h>
22

3+
#if RCT_NEW_ARCH_ENABLED
34
#import <FBReactNativeSpec_visionOS/FBReactNativeSpec_visionOS.h>
5+
#endif
46

57
#import <React/RCTBridge.h>
68
#import <React/RCTConvert.h>
79
#import <React/RCTUtils.h>
810
#import "RCTXR-Swift.h"
911

12+
#if RCT_NEW_ARCH_ENABLED
1013
@interface RCTXRModule () <NativeXRModuleSpec>
1114
@end
15+
#endif
1216

1317
@implementation RCTXRModule {
1418
UIViewController *_immersiveBridgeView;
@@ -56,6 +60,19 @@ @implementation RCTXRModule {
5660
});
5761
}
5862

63+
- (void) removeImmersiveBridge
64+
{
65+
RCTExecuteOnMainQueue(^{
66+
[self->_immersiveBridgeView willMoveToParentViewController:nil];
67+
[self->_immersiveBridgeView.view removeFromSuperview];
68+
[self->_immersiveBridgeView removeFromParentViewController];
69+
self->_immersiveBridgeView = nil;
70+
});
71+
}
72+
73+
#pragma mark New Architecture
74+
75+
#if RCT_NEW_ARCH_ENABLED
5976
- (facebook::react::ModuleConstants<JS::NativeXRModule::Constants::Builder>)constantsToExport {
6077
return [self getConstants];
6178
}
@@ -70,20 +87,13 @@ @implementation RCTXRModule {
7087

7188
return constants;
7289
}
90+
#endif
7391

74-
- (void) removeImmersiveBridge
75-
{
76-
RCTExecuteOnMainQueue(^{
77-
[self->_immersiveBridgeView willMoveToParentViewController:nil];
78-
[self->_immersiveBridgeView.view removeFromSuperview];
79-
[self->_immersiveBridgeView removeFromParentViewController];
80-
self->_immersiveBridgeView = nil;
81-
});
82-
}
83-
92+
#if RCT_NEW_ARCH_ENABLED
8493
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
8594
return std::make_shared<facebook::react::NativeXRModuleSpecJSI>(params);
8695
}
96+
#endif
8797

8898
+ (BOOL)requiresMainQueueSetup
8999
{

packages/react-native/Libraries/XR/React-RCTXR.podspec

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ else
1111
source[:tag] = "v#{version}"
1212
end
1313

14+
is_new_arch_enabled = ENV["RCT_NEW_ARCH_ENABLED"] == "1"
15+
new_arch_enabled_flag = (is_new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "")
16+
1417
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
1518
folly_version = '2022.05.16.00'
19+
compiler_flags = folly_compiler_flags + + new_arch_enabled_flag + ' -Wno-nullability-completeness'
1620

1721
header_search_paths = [
1822
"\"$(PODS_ROOT)/RCT-Folly\"",
@@ -28,7 +32,7 @@ Pod::Spec.new do |s|
2832
s.license = package["license"]
2933
s.author = "Callstack"
3034
s.platforms = min_supported_versions
31-
s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness'
35+
s.compiler_flags = compiler_flags
3236
s.source = source
3337
s.source_files = "*.{m,mm,swift}"
3438
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"

0 commit comments

Comments
 (0)