You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented actions to change based on whether the return value of requestPermission is true or false. However, the actions did not occur as specified on iOS. Upon checking, I found that the returned value was coming in as an array.
Below is a photo of my code and the result values confirmed via console.log.
1. Install v5.0.5
2. Launch the app on iOS device
3. Use the requestPermission method for notifications with console.log like my code
What did you expect to happen?
It should have returned a Promise as the specified type. On Android, it correctly returns a boolean, but on iOS, it is returning a Promise<boolean[]> instead.
React Native OneSignal SDK version
Release 5.0.5
Which platform(s) are affected?
iOS
Android
Relevant log output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
I am also falling into this issue, any updates since Feb @nan-li?
The workaround in the meantime is to override the types and unwrap the array:
// FIXME: iOS returns a boolean tuple so unwrap it to provide a boolean as expected// @see https://github.com/OneSignal/react-native-onesignal/issues/1655constvalue=(awaitOneSignal.Notifications.requestPermission(true))asboolean|[boolean];constgranted=Array.isArray(value) ? value[0] : value;// `granted` is now always a boolean as per the types
What happened?
react-native: 0.73.2
device: iphone 12 mini
iOS version: 17.3.1
onesignal version: 5.0.5
I implemented actions to change based on whether the return value of requestPermission is true or false. However, the actions did not occur as specified on iOS. Upon checking, I found that the returned value was coming in as an array.
Below is a photo of my code and the result values confirmed via console.log.
Steps to reproduce?
What did you expect to happen?
It should have returned a Promise as the specified type. On Android, it correctly returns a boolean, but on iOS, it is returning a Promise<boolean[]> instead.
React Native OneSignal SDK version
Release 5.0.5
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: