evollu / evollu/react-native-fcm
Problems with expo. TypeError: undefined is not an object (evaluating 'RNFIRMessaging.requestPermissions')
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 661
- PR merge metrics
- No merged PRs in 30d
Description
I have a problem starting the app in expo (Android & iOS).
Every time i try to to call a Method from FCM, i get an error like the following:
```
TypeError: undefined is not an object (evaluating 'RNFIRMessaging.requestPermissions')
This error is located at:
in PushNotification (at App.js:44)
in RCTView (at View.js:60)
in View (at App.js:42)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
```
Here is the code I use:
```
import React, { Component } from "react";
import FCM, { FCMEvent } from "react-native-fcm";
export default class PushNotification extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
// this method generate fcm token.
FCM.requestPermissions();
FCM.getFCMToken().then(token => {
console.info("TOKEN (getFCMToken)", token);
});
FCM.subscribeToTopic('all');
// This method get all notification from server side.
FCM.getInitialNotification().then(notif => {
console.info("INITIAL NOTIFICATION", notif)
});
...
```
When I compile to APK everything is working fine.
What am I doing wrong?
Is the package not compatible with expo?
I know similar problems where already discussed for Android and iOS builds. But i found nothing related to expo...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.