From 842aa608dd65c40a4cf424b526d114be42daecbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=87?= <4001793+dubiao@users.noreply.github.com> Date: Tue, 10 Mar 2026 18:58:53 +0800 Subject: [PATCH] Change mixWithOthers type to BOOL in setCategory This matches the declaration in index.d.ts --- ios/RNSound.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ios/RNSound.mm b/ios/RNSound.mm index 94b2335b..58d46b63 100644 --- a/ios/RNSound.mm +++ b/ios/RNSound.mm @@ -142,12 +142,12 @@ - (NSString *)modeForName:(NSString *)modeName { return modes[modeName]; } -RCT_EXPORT_METHOD(setCategory:(NSString *)categoryName mixWithOthers:(NSNumber *)mixWithOthers) { +RCT_EXPORT_METHOD(setCategory:(NSString *)categoryName mixWithOthers:(BOOL)mixWithOthers) { AVAudioSession *session = [AVAudioSession sharedInstance]; NSString *category = [self categoryForName:categoryName]; if (category) { - if (mixWithOthers.boolValue) { + if (mixWithOthers) { [session setCategory:category withOptions:AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth error:nil]; @@ -176,8 +176,11 @@ - (NSString *)categoryForName:(NSString *)categoryName { } #pragma mark - Audio Control Methods - +#ifdef RCT_NEW_ARCH_ENABLED RCT_EXPORT_METHOD(prepare:(NSString *)fileName key:(double)key options:(JS::NativeSoundIOS::SoundOptionTypes &)options callback:(RCTResponseSenderBlock)callback ) { +#else +RCT_EXPORT_METHOD(prepare:(NSString *)fileName key:(double)key options:(NSDictionary *)options callback:(RCTResponseSenderBlock)callback ) { +#endif NSError *error; NSURL *fileNameUrl; AVAudioPlayer *player;