I am running a React Native app.
I have defined a method "requestAuthorization" in my react-native-library. This method invokes healthkit to get the necessary authorizations.
This feature is only for ios. It does not support Android.
index.ts
const requestAuthorization = ( read: (healthTypes)[], write: healthTypes[] = []): Promise<boolean> => { const readAuth = read.reduce((obj, cur) => { return { ...obj, [cur]: true }; }, {}); const writeAuth = write.reduce((obj, cur) => { return { ...obj, [cur]: true }; }, {}); return Native.requestAuthorization(writeAuth, readAuth);};const MyHealthLibrary: iosHealthkit = { requestAuthorization}export default MyHealthLibrary;
index.version.ts
const version = () => { throw Alert.alert("Platform",'Platform "'+ Platform.OS +'" not supported', [ { text: "Cancel", onPress: () => console.log("Cancel Pressed"), style: "cancel" } ], { cancelable: false } );};const MyHealthLibrary: iosHealthkit = { requestAuthorization: version};export default MyHealthLibrary;
So when i try to invoke "requestAuthorization" in Android it throws an Alert.
The Alert is working fine. But i get a warning below. I do not want that warning, i just want the alert. How can i remove the warning???