React native 使用react native expo进行深度链接-不打开屏幕
场景:用户1与用户2共享了注册链接 用户2单击了链接 预期结果:注册屏幕应打开 实际结果:它没有打开,而是打开了默认的第一个导航器 已单击链接:url:'exp://kj-97q.anonymous.metordunia.exp.direct:80/--/注册' 问题:请说明我做错了什么React native 使用react native expo进行深度链接-不打开屏幕,react-native,expo,deep-linking,React Native,Expo,Deep Linking,场景:用户1与用户2共享了注册链接 用户2单击了链接 预期结果:注册屏幕应打开 实际结果:它没有打开,而是打开了默认的第一个导航器 已单击链接:url:'exp://kj-97q.anonymous.metordunia.exp.direct:80/--/注册' 问题:请说明我做错了什么 export default class App extends React.Component { componentDidMount (){ // If the app is NOT already
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 query 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 :", path);
console.log("path url query parameter:", queryParams);
console.log(`Linked to app with path: ${path} and data: ${JSON.stringify(queryParams)}`);
this.props.navigation.navigate(path,queryParams);
}
@mav raj你能帮忙吗?
Login: {
screen: Loginstack,
path:login,
},
Signup: {
screen: Signupstack,
path:'signup',
},