Skip to content

Commit

Permalink
fix(#106): FBReactNativeSpec_visionOS.h not found
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Feb 12, 2024
1 parent 2a2bf47 commit d79d12a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
30 changes: 20 additions & 10 deletions packages/react-native/Libraries/XR/RCTXRModule.mm
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#import <React/RCTXRModule.h>

#if RCT_NEW_ARCH_ENABLED
#import <FBReactNativeSpec_visionOS/FBReactNativeSpec_visionOS.h>
#endif

#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>
#import "RCTXR-Swift.h"

#if RCT_NEW_ARCH_ENABLED
@interface RCTXRModule () <NativeXRModuleSpec>
@end
#endif

@implementation RCTXRModule {
UIViewController *_immersiveBridgeView;
Expand Down Expand Up @@ -56,6 +60,19 @@ @implementation RCTXRModule {
});
}

- (void) removeImmersiveBridge
{
RCTExecuteOnMainQueue(^{
[self->_immersiveBridgeView willMoveToParentViewController:nil];
[self->_immersiveBridgeView.view removeFromSuperview];
[self->_immersiveBridgeView removeFromParentViewController];
self->_immersiveBridgeView = nil;
});
}

#pragma mark New Architecture

#if RCT_NEW_ARCH_ENABLED
- (facebook::react::ModuleConstants<JS::NativeXRModule::Constants::Builder>)constantsToExport {
return [self getConstants];
}
Expand All @@ -70,20 +87,13 @@ @implementation RCTXRModule {

return constants;
}
#endif

- (void) removeImmersiveBridge
{
RCTExecuteOnMainQueue(^{
[self->_immersiveBridgeView willMoveToParentViewController:nil];
[self->_immersiveBridgeView.view removeFromSuperview];
[self->_immersiveBridgeView removeFromParentViewController];
self->_immersiveBridgeView = nil;
});
}

#if RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
return std::make_shared<facebook::react::NativeXRModuleSpecJSI>(params);
}
#endif

+ (BOOL)requiresMainQueueSetup
{
Expand Down
6 changes: 5 additions & 1 deletion packages/react-native/Libraries/XR/React-RCTXR.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ else
source[:tag] = "v#{version}"
end

is_new_arch_enabled = ENV["RCT_NEW_ARCH_ENABLED"] == "1"
new_arch_enabled_flag = (is_new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "")

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'
folly_version = '2022.05.16.00'
compiler_flags = folly_compiler_flags + + new_arch_enabled_flag + ' -Wno-nullability-completeness'

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

0 comments on commit d79d12a

Please sign in to comment.