Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

TypeError: Undefined is not an object (evaluating '_pushNotifications.pushNotifications.configure') React Native

$
0
0

I am new to React Native and am trying to create push notifications on iOS with push-notification-ios and react-native-push-notification. I am following a number of different tutorials on this as I am still learning how it works.

When I run my app I get the following error.

error

Here is my code

const configure = async () => {    console.log('push notification configured');    PushNotificationIOS.addEventListener('registrationError', (e) => {    PushNotifcation.configure({        onRegister: function(token) {            //process token            alert('Token!'+ JSON.stringify(token));            console.log('[CATCHED] onRegister:', token);            db.setToken(token).catch(               console.log('[ERROR] device push token has not been saved on the database'),             );        },        onNotification: async function(notification) {            console.log('[CATCHED] onNotification:'+ JSON.stringify(notification));            let notifType = '';            if (Platform.OS === 'ios') {                notifType = getNotificationType(                    JSON.parse(notification.data.data).type,                );            } else {                notifType = getNotificationType(                    notification.type,                );            }            //process the notification            //required on iOS only            if (Platform.OS === 'ios') {            notification.finish(PushNotificationIOS.FetchResult.NoData);            }            },            senderID: '-----',        permissions: {            alert: true,            badge: true,            sound: true        },        popInitialNotification: true,        requestPermissions: true,    });    });}export {    configure,};

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>