0

What is the right way to use the "requestNotifications" function? Defined in the library "react-native-permissions".

I tried:

await requestNotifications({
            sound: true,
            vibrate: true,
            alert: true,
        });

but i get the error "... if type NSMutableDisctionary cannot be converted to NSArray"

What is wrong with the function call?

Function declare is requestNotifications(options: NotificationOption[]): Promise<NotificationsResponse>;

iSaBo
  • 117
  • 9

1 Answers1

1

Your function require arrays with string instead of object. So your code should looks like requestNotifications(['alert', 'sound'])

Possible options: 'alert' | 'badge' | 'sound' | 'criticalAlert' | 'carPlay' | 'provisional' | 'providesAppSettings';

More informations

Darex1991
  • 855
  • 1
  • 10
  • 24