diff --git a/build/getDevicePushTokenAsync.js b/build/getDevicePushTokenAsync.js index f0875c5eaa84d45d646edd1ad5f21a962f68ab02..d93813b2636f1ac5e09081c3207407410a404698 100644 --- a/build/getDevicePushTokenAsync.js +++ b/build/getDevicePushTokenAsync.js @@ -20,8 +20,11 @@ export async function getDevicePushTokenAsync() { else { // Create a new Promise and clear it afterwards nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync(); - devicePushToken = await nativeTokenPromise; - nativeTokenPromise = null; + try { + devicePushToken = await nativeTokenPromise; + } finally { + nativeTokenPromise = null; + } } // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it return { type: Platform.OS, data: devicePushToken }; diff --git a/src/getDevicePushTokenAsync.ts b/src/getDevicePushTokenAsync.ts index ab518dff463bc1a92052329ce5ac7c9055cbcf62..ad164f162998b5c1e218f089be82ab474727d68e 100644 --- a/src/getDevicePushTokenAsync.ts +++ b/src/getDevicePushTokenAsync.ts @@ -24,8 +24,11 @@ export async function getDevicePushTokenAsync(): Promise { } else { // Create a new Promise and clear it afterwards nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync(); - devicePushToken = await nativeTokenPromise; - nativeTokenPromise = null; + try { + devicePushToken = await nativeTokenPromise; + } finally { + nativeTokenPromise = null; + } } // @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it