Environment
"expo": "^36.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-webview": "^7.4.3"
Code
componentDidMount() {
this._notificationSubscription = Notifications.addListener(this._handleNotification);
}
postMessageToWebview = (jsonMessage) => {
this.webview.postMessage(jsonMessage);
}
_handleNotification = (notification) => {
const notificationCaseId = notification.data.details.caseId;
const myUrl = this.props.urlViewUpdatedCaseProp + notificationCaseId + '&viewComment=1';
this.postMessageToWebview(JSON.stringify({viewcomment:true,redirecturl:myUrl}));
}
When notifications received and app was running, user clicks on notification banner, it triggers _handleNotification and postMessage to the UI which redirects user to the redirecturl. This works on both iOS and Android.
However, when notifications received and app was closed, user clicks on notification banner:
On iOS:
It triggers _handleNotification but never postMessage to the UI
On Android:
It never triggers _handleNotification