使用react native expo进行深层链接-不打开屏幕

问题描述

方案用户1与用户2共享了注册链接

用户2单击了链接

预期结果:应该会打开“注册”屏幕

实际结果:它没有打开而是打开了认的第一个导航器

点击链接:url:'exp://kj-97q.anonymous.metordunia.exp.direct:80 /-/ signup'

问题:请提出我在做什么错

export default class App extends React.Component {


componentDidMount (){
 // If the app is NOT already open and the app is opened by clicking an url-->handle an initial url on app opening
  Linking.getinitialURL().then( ( url)=>{
    const {path,queryParams }=Linking.parse(url);
console.log("path url  from if the app is NOT already opened get intiial url:",path);
console.log("path url quary parameter:",queryParams);
console.log(`Linked to app with path: ${path} and data: ${JSON.stringify(queryParams)}`);  
this.props.navigation.navigate(path,queryParams);

  
  });

  // If the app is YES already open and the app is opened by clicking an url-->handle an initial url on app opening
Linking.addEventListener("url",event=>{

  this.urlRedirect(event.url)
}

)


}



urlRedirect=(url)=>{
  if (! url) return;
  // parse and redirect to new url
  const {path,queryParams }=Linking.parse(url);
  console.log("path url if app is YES already opened add event listener :",queryParams);
console.log(`Linked to app with path: ${path} and data: ${JSON.stringify(queryParams)}`);
this.props.navigation.navigate(path,queryParams);


}
  1. 导航器详细信息

    const AppNavigator = createBottomTabNavigator({

       Login: {
         screen: Loginstack,path:login,},Signup: {
         screen: Signupstack,path:'signup',

    },

  2. 控制台日志

    从尚未打开应用程序开始的路径URL获取初始URL:注册

    path url quary参数:对象{}

    通过以下路径链接到应用:注册和数据:{}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)