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

TypeError: Cannot read property 'additionalData' of undefined, js engine: hermes

$
0
0

additionalData can bee a object or undefined. And same with validation not print in console. Occurs this error "TypeError: Cannot read property 'additionalData' of undefined, js engine: hermes"

if print the notification variable on the console, the variable "additionalData" appears as follows: { "payload": "additionalData": [object] }

const onReceived = useCallback((notification: ReceivedNotification) => {const { additionalData } = notification.payload;if (additionalData) {    console.log(additionalData);  }}, []);useEffect(() => {  OneSignal.init('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');  OneSignal.addEventListener('opened', onReceived);  OneSignal.addEventListener('ids', onIds);  OneSignal.inFocusDisplaying(2);  OneSignal.clearOneSignalNotifications();}, [onIds, onReceived]);

Viewing all articles
Browse latest Browse all 6287

Trending Articles



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