Reputation: 161
I am trying to get output from native function to use in frontend, here is the function,
RCT_EXPORT_METHOD(getActiveAudioDevice:
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
MediaDevice * _Nullable devices = [meetingSession.audioVideo getActiveAudioDevice];
NSLog(@"Hello Devices: %@", devices);
if (!devices) {
reject(@"event_failure", @"failed to list audio devices", nil);
} else {
resolve(devices);
}
}
I am triggering it in JS like this ,
const selectedAudioDevice = useCallback(async() => {
const activeDevice= await NativeFunction.selectedDevice("")
setActiveDevice(activeDevice) }
When I trigger this from frontend I can see in logs that Native function is returning a device but in JS all I get is undefined, any idea what I am doing wrong here ?
Upvotes: 1
Views: 264