export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
received: false,
}
Notifications.addListener((notification) => {
console.log('received', notification);
this.setState({ received: true })
});
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight
onPress={() => Notifications.presentLocalNotificationAsync({
title: 'Notification',
ios: {
sound: true,
},
android: {
sound: true,
priority: 'max',
vibrate: true,
},
})}
>
<Text>Click for notification</Text>
</TouchableHighlight>
<Text>Listener called: {this.state.received.toString()}</Text>
</View>
);
}
}
Function in Notifications.addListener
gets called perfectly fine in https://expo.io/@riwu/expotest
But once I detach Expo, it stop working even though Notifications.presentLocalNotificationAsync
still works and user is still able to receive the notification.