Talor-A / react-native-message-bar

A notification bar alert displayed at the top of the screen for react-native
MIT License
55 stars 27 forks source link

function undefined onTapped #14

Closed AFMW closed 6 years ago

AFMW commented 6 years ago

im trying to call a function i created to do some actions and when i call it from de onTapped property it shows the "Unhandled JS Exception: this.routerInbox is not a function. (In 'this.routerInbox(e)'" error.

here's my code:

the routerInbox function: routerInbox(notification){ idMensajePush=notification.data.id console.log( 'id mio: ', dataMio.data.id ) Actions.inbox() Actions.DetalleMensajes(idMensajePush,{ type: ActionConst.REPLACE}) }

the props of the MessageBar: MessageBarManager.showAlert({ title: 'Ha llegado un nuevo mensaje', message: notification.alert, alertType: 'info', onTapped: this.routerInbox(notification) });

Talor-A commented 6 years ago

try replacing it with onTapped: ()=>this.routerInbox(notification)