[ios][notifications] Handle messaging token refreshed before bridge initialised #960

This commit is contained in:
Chris Bianca
2018-04-13 14:22:17 +01:00
parent 93b4e3e052
commit 3a5686c226
2 changed files with 41 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
* @flow
* Messaging (FCM) representation wrapper
*/
import { Platform } from 'react-native';
import { SharedEventEmitter } from '../../utils/events';
import INTERNALS from '../../utils/internals';
import { getLogger } from '../../utils/log';
@@ -63,6 +64,11 @@ export default class Messaging extends ModuleBase {
SharedEventEmitter.emit('onTokenRefresh', token);
}
);
// Tell the native module that we're ready to receive events
if (Platform.OS === 'ios') {
getNativeModule(this).jsInitialised();
}
}
getToken(): Promise<string> {