From f649753f1639e7777196bac549891cf4626c710a Mon Sep 17 00:00:00 2001 From: Michal Sek Date: Tue, 29 Oct 2024 20:17:39 +0100 Subject: [PATCH] fix: android on rn 0.76.1 --- .../react-native-audio-api/android/CMakeLists.txt | 3 +-- .../react-native-audio-api/ios/AudioAPIModule.mm | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/react-native-audio-api/android/CMakeLists.txt b/packages/react-native-audio-api/android/CMakeLists.txt index 8e1d514b..376e3b9e 100644 --- a/packages/react-native-audio-api/android/CMakeLists.txt +++ b/packages/react-native-audio-api/android/CMakeLists.txt @@ -52,10 +52,9 @@ find_package(fbjni REQUIRED CONFIG) find_package (oboe REQUIRED CONFIG) set(LINK_LIBRARIES + ReactAndroid::reactnative ReactAndroid::jsi - ReactAndroid::reactnativejni fbjni::fbjni - ReactAndroid::folly_runtime android log oboe::oboe diff --git a/packages/react-native-audio-api/ios/AudioAPIModule.mm b/packages/react-native-audio-api/ios/AudioAPIModule.mm index d5bb5f3e..7c2cc57a 100644 --- a/packages/react-native-audio-api/ios/AudioAPIModule.mm +++ b/packages/react-native-audio-api/ios/AudioAPIModule.mm @@ -14,19 +14,23 @@ @implementation AudioAPIModule RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) { NSLog(@"Installing JSI bindings for react-native-audio-api..."); - RCTBridge *bridge = [RCTBridge currentBridge]; - RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge; + RCTCxxBridge *cxxBridge = (RCTCxxBridge *)[RCTBridge currentBridge]; + if (cxxBridge == nil) { + NSLog(@"Error during getting bridge!"); return @false; } using namespace facebook; - auto jsiRuntime = (jsi::Runtime *)cxxBridge.runtime; - if (jsiRuntime == nil) { + auto jsRuntime = (jsi::Runtime *)cxxBridge.runtime; + + if (jsRuntime == nil) { + NSLog(@"Error during getting jsRuntime!"); return @false; } - auto &runtime = *jsiRuntime; + + auto &runtime = *jsRuntime; auto wrapper = std::make_shared(); auto hostObject = std::make_shared(wrapper);