yutasuzuki / react-native-record-screen

react-native-record-screen
MIT License
149 stars 40 forks source link

Permission denied will not throw #30

Open WangHansen opened 3 years ago

WangHansen commented 3 years ago

It seems that the granted value will always be true here: https://github.com/yutasuzuki/react-native-record-screen/blob/cc2a2ed5f2ad7cfb845547d7d60c619d1dc170ec/ios/RecordScreen.m#L124

But if I denied the access, the error will be captured in here: https://github.com/yutasuzuki/react-native-record-screen/blob/cc2a2ed5f2ad7cfb845547d7d60c619d1dc170ec/ios/RecordScreen.m#L168

iwantadventureinthegreatwidesomewhere commented 3 years ago

@WangHansen Did you find a solution for this? I am experiencing the same issue on iOS, Android works fine.

LuridChang commented 2 years ago

edit: https://github.com/yutasuzuki/react-native-record-screen/blob/cc2a2ed5f2ad7cfb845547d7d60c619d1dc170ec/ios/RecordScreen.m#L169 to

if (error) {
  resolve(@"fail");
} else {
  resolve(@"started");
}

edit: https://github.com/yutasuzuki/react-native-record-screen/blob/cc2a2ed5f2ad7cfb845547d7d60c619d1dc170ec/src/index.tsx#L3 to export declare type RecordingStartResponse = 'started' | 'fail';

edit:

import RecordScreen from 'react-native-record-screen';

// recording start
const res = await RecordScreen.startRecording().catch((error) => console.error(error));
if (res=="fail") {
  //do something after user denied the access
}