Skip to content

[📚] Messaging - Show Modular Example instead of Namespaced in documentation #8608

@estani

Description

@estani

Documentation Feedback

Please describe your documentation issue or suggested improvement in detail here and provide links to any pre-existing/relevant documentation and screenshots if necessary:

In https://rnfirebase.io/messaging/usage#ios---requesting-permissions
Image
The "deprecated" usage is documented.
I've tried to use the modular "recommended" one, but without success.
I've changed it to:

import { hasPermission, requestPermission } from "@react-native-firebase/messaging";
// changed from messaging.hasPermission();
let permission = await hasPermission(/* Messaging instance expected */);
// ...
//changed from messaging.requestPermission()
permission = await requestPermission(
 /* messaging: Messaging, iosPermissions?: FirebaseMessagingTypes.IOSPermissions */)
);

Or is it ment to not be used at all?

const firebaseApp = getApp();
const messaging = getMessaging(firebaseApp);
// But... Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp()

It is not clear to me what should be used now, and where the messaging object should come from. Please update the docs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions