[messaging] Correctly bind messaging listeners
This commit is contained in:
parent
782958d026
commit
cd347383a4
|
@ -204,7 +204,7 @@ export default class Messaging extends Base {
|
|||
* @returns {*}
|
||||
*/
|
||||
onMessage(listener: Function): () => any {
|
||||
return FirebaseMessagingEvt.addListener(
|
||||
const rnListener = FirebaseMessagingEvt.addListener(
|
||||
EVENT_TYPE.Notification,
|
||||
async(event) => {
|
||||
const data = {
|
||||
|
@ -217,7 +217,8 @@ export default class Messaging extends Base {
|
|||
data.finish();
|
||||
}
|
||||
}
|
||||
).remove;
|
||||
);
|
||||
return () => rnListener.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,7 +227,8 @@ export default class Messaging extends Base {
|
|||
* @returns {*}
|
||||
*/
|
||||
onTokenRefresh(listener: Function): () => any {
|
||||
return FirebaseMessagingEvt.addListener(EVENT_TYPE.RefreshToken, listener).remove;
|
||||
const rnListener = FirebaseMessagingEvt.addListener(EVENT_TYPE.RefreshToken, listener);
|
||||
return () => rnListener.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue