React Native-当应用程序不在后台(Android,iOS)时,深层链接不起作用 [英] React Native - Deep linking is not working when app is not in background (Android, iOS)
本文介绍了React Native-当应用程序不在后台(Android,iOS)时,深层链接不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 如果应用程序在后台
- if app in background
特定的屏幕将打开.
specific screen will open.
它将仅显示第一个屏幕.
it will show first screen only.
Linking.getInitialURL()返回null
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();
}, []);
* //以上解决方案对我来说是有效的
这篇关于React Native-当应用程序不在后台(Android,iOS)时,深层链接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文