- 如果应用在后台
specific screen will open.
- 如果应用程序不在后台或终止应用程序
it will show first screen only.
Linking.getInitialURL() is return null
最佳答案
如果您想在应用被终止或尚未启动的情况下进行重定向,请找到以下简单的解决方案:
// Don't forget to import
import {
Linking
} from 'react-native';
useEffect(() => {
const getAsyncURL = async () => {
const initialUrl = await Linking.getInitialURL();
if (initialUrl != undefined && initialUrl != null){
// Handle initialURL as per your response and open a specific screen using navigation
}
};
getAsyncURL();
}, []);
*//上面的解决方案对我有用
关于android - React Native - 当应用程序不在后台时,深度链接不起作用(Android、iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62693760/