I receive this error when I click the notification
Hey @samassango!
Iâm really sorry youâre encountering this issue, must be annoying.
Could you please give me some more information about your Expo app? What SDK version are you on? Are you detached? Do you have any code examples?
In addition, if you upgraded Expo SDK for your current project, could you let me know whether or not you were aware of the breaking changes? I can help you find those if you need help.
Look forward to hearing back from you!
Hey @jimmylee
I am currently using the following
react
version ^16.0.0-alpha.12
react-native
version 0.47.0
expo
version 20.0.0
I was using
expo 15.0.0
and upgraded to 20.0.0
example where notification itâs implemented
root App.js
`import React, { Component } from âreactâ;
import { Platform } from âreact-nativeâ;
import AppNavigator from â./AppNavigatorâ;
import { createTBLLogin, createTBLHistory} from â./utils/sqliteHelperâ;
import Expo, { Notifications, SQLite } from âexpoâ;
import { registerForPushNotificationsAsync } from â./utils/firebaseConfigâ;
import { Actions } from âreact-native-router-fluxâ;
export const sqLiteDataSorce = SQLite.openDatabase(âtshwaneMobi.dbâ);
class App extends Component {
componentWillMount(){
createTBLLogin(sqLiteDataSorce);
createTBLHistory(sqLiteDataSorce);
registerForPushNotificationsAsync();
this._notificationSubscription = Notifications.addListener(this._handleNotification);
}
_handleNotification = (notification) => {
console.log(ânotificâ,notification);
if(notification.origin ===âselectedâ){
if(notification.data.type === âcasehistoryâ){
Actions.timeline({notificationObject: notification});
}else{
Actions.home({notificationObject: notification})
}
}
};
render() {
return ;
}
}
export default App;
`
`export async function registerForPushNotificationsAsync() {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
let { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
// Stop here if the user did not grant permissions
if (status !== âgrantedâ) {
return;
}
// Get the token that uniquely identifies this device
let token = await Notifications.getExpoPushTokenAsync();
};`
Is there anyway you can try to update your application to the latest SDK to see if it resolves your issues?
hey, did you follow the sdk upgrade instructions for sdk 15 - 20? theres a lot of small changes that most likely caused a small error thats crashing the app.
i also have a demo app with the latest sdk and source code available with notification examples. you can check out the source and see if its helpful