I am configuring and initialising firebase app still FCM messaging results in an error saying Firebase App not initialised.
import FCM from "react-native-fcm";
const firebaseConfig = {
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
messagingSenderId: "xxx",
storageBucket: "xxx",
};
const firebaseApp = firebase.initializeApp(firebaseConfig);
class App extends Component {
configureStore()
{
const store = createStore(reducer,undefined,compose(autoRehydrate()));
persistStore(store,{ storage: AsyncStorage })
return store;
}
constructor(props)
{
super(props);
}
componentDidMount()
{
FCM.requestPermissions()
.then(()=>console.log('granted'))
.catch(()=>console.log('notification permission rejected'));
FCM.getFCMToken()
.then(token => {
alert("TOKEN (getFCMToken)", token);
})
.catch((error)=> alert(error))
}
}
FCM notification permission is granted but then the getToken method results in an error of firebase app not initialised instead of initialising it at the top,