问题描述
expo-linking
React Native 包有一个名为 useURL
的钩子,当应用程序在后台时它对我不起作用。从 docs it Returns the initial URL followed by any subsequent changes to the URL.
我的托管博览会应用程序遇到的问题是,当应用程序已经在后台打开时,钩子不起作用。这是钩子:
export default function App() {
const isLoadingComplete = useCachedResources();
const url = Linking.useURL();
useEffect(() => {
Alert.alert(url ? url.substring(20) : 'null');
},[url]);
if (!isLoadingComplete) {
return null;
} else {
return (
...
);
}
}
如果我在应用关闭时打开 URL exp://exp.host/@myprofile/myproject?a=b
,我会按预期收到警报。如果应用程序在后台,则警报不会关闭。我已经在 iOS 模拟器和物理 Android 上进行了测试。任何解决方案?请注意,Linking.addEventListener()
也会出现类似的问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)