-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[notifications] Export NotificationPermissions.types #8747
[notifications] Export NotificationPermissions.types #8747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! Would you care to add a changelog entry for this, please? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10q! 🙏
Whats the fix for this? I have this issue currently. |
Could do this in the meantime: import * as Notifications from "expo-notifications";
import { IosAuthorizationStatus } from "expo-notifications/build/NotificationPermissions.types";
export async function allowsNotificationsAsync() {
const settings = await Notifications.getPermissionsAsync();
return (
settings.granted || settings.ios?.status === IosAuthorizationStatus.PROVISIONAL
);
} |
@hassey - this should be included in the latest release, at the time of writing expo-notifications@0.6.0 |
Why
This example code from the README currently results in
[TypeError: undefined is not an object (evaluating 'Notifications.IosAuthorizationStatus.PROVISIONAL')]
:How
Exported
NotificationPermissions.types
fromindex.ts
and added a simple check to verify thatNotifications.IosAuthorizationStatus
is defined when importing fromexpo-notifications
entry point to prevent regression in the future.Test Plan
Run test included in PR, run the code provided in the "Why" section above.