From a92f8b240729f54a03465de19b492330ac4da625 Mon Sep 17 00:00:00 2001 From: Injung Chung Date: Wed, 8 May 2019 10:46:01 +0900 Subject: [PATCH] [Android] Make Linking.getInitialURL works properly even if current activity is not initialized --- Libraries/Linking/Linking.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 6dfd3c7cccce30..845edb9edcd8df 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -13,6 +13,7 @@ const NativeEventEmitter = require('NativeEventEmitter'); const NativeModules = require('NativeModules'); const Platform = require('Platform'); +const InteractionManager = require('InteractionManager'); const invariant = require('invariant'); @@ -87,7 +88,11 @@ class Linking extends NativeEventEmitter { * See https://facebook.github.io/react-native/docs/linking.html#getinitialurl */ getInitialURL(): Promise { - return LinkingManager.getInitialURL(); + return Platform.OS === 'android' + ? InteractionManager.runAfterInteractions().then(() => + LinkingManager.getInitialURL(), + ) + : LinkingManager.getInitialURL(); } /*