[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 {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
onMessage(listener: Function): () => any {
|
onMessage(listener: Function): () => any {
|
||||||
return FirebaseMessagingEvt.addListener(
|
const rnListener = FirebaseMessagingEvt.addListener(
|
||||||
EVENT_TYPE.Notification,
|
EVENT_TYPE.Notification,
|
||||||
async(event) => {
|
async(event) => {
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -217,7 +217,8 @@ export default class Messaging extends Base {
|
||||||
data.finish();
|
data.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).remove;
|
);
|
||||||
|
return () => rnListener.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,7 +227,8 @@ export default class Messaging extends Base {
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
onTokenRefresh(listener: Function): () => any {
|
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