您当前的位置: 首页 >  ar

ITKEY_

暂无认证

  • 0浏览

    0关注

    732博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

WARN Found screens with the same name nested inside one another.

ITKEY_ 发布时间:2021-10-30 08:35:45 ,浏览量:0

警告信息

WARN Found screens with the same name nested inside one another. Check:

DrawerNavigator > MainTabNavigator > ServiceScreen, DrawerNavigator > MainTabNavigator > ServiceScreen > ServiceScreen

This can cause confusing behavior during navigation. Consider using unique names for each screen instead. BaseNavigationContainer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.reactjs.native.example.ywh:147787:28 ThemeProvider@http://localhost:8081/index.bundle?platform=ios&dev=true

在这里插入图片描述

原因分析

通过这个层级关系可以看出,写代码的过程中出现名称相同的Screen组件。

  • DrawerNavigator > MainTabNavigator > ServiceScreen,
  • DrawerNavigator > MainTabNavigator > ServiceScreen > ServiceScreen

虽然是一个警告,但是看着还是很难受的。

解决办法

因为我用Stack把ServiceScreen又嵌套了一层,让它能有header。但是写的时候忘记修改名称了。

const ServiceStackScreen = ({navigation}: any) => {
  return (
    
  );
};

screenName={‘ServiceScreen’}修改成screenName={‘ServiceStackScreen’} 问题解决。

总结

粗心导致的问题。

关注
打赏
1665243900
查看更多评论
立即登录/注册

微信扫码登录

0.0635s