如何删除到达导航5.x警告 [英] How to remove reach navigation 5.x warnings

查看:137
本文介绍了如何删除到达导航5.x警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用React Native Expo开发一个移动应用程序.我使用了React Navigation版本5.x并收到以下警告:

web编译有警告.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:未从中导出"DrawerActionType" './DrawerRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:未从中导出"DrawerNavigationState" './DrawerRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:"DrawerRouterOptions"未从中导出 './DrawerRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:未从中导出"StackActionType" './StackRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:未从中导出"StackNavigationState" './StackRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:未从中导出"StackRouterOptions" './StackRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:"TabActionType"未从中导出 './TabRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:"TabNavigationState"未从中导出 './TabRouter'.

D:/_ expo/navi/node_modules/@react-navigation/routers/lib/module/index.js 尝试导入错误:"TabRouterOptions"未从中导出 './TabRouter'.

请指导.

解决方案

删除未从文件中导出的导入.

从我看到的StackRouter,TabRouter和DrawerRouter遵循相同的模式,并且没有导出带有结尾的导入:ActionType,RouterOptions和NavigationState.

我不知道世博会是否将这些进口商品留作以后使用SDK或一些我不了解的东西将其包括进来,我在这里进行了更改,我的项目在没有这些黄色框的情况下继续正常运行./p>

node_modules/@react-navigation/routers/lib/module/index.js之前:

import * as CommonActions from './CommonActions';
export { CommonActions };
export { default as BaseRouter } from './BaseRouter';
export { default as StackRouter, StackActions, StackActionType, StackRouterOptions,         StackNavigationState } from './StackRouter';
export { default as TabRouter, TabActions, TabActionType, TabRouterOptions, TabNavigationState } from './TabRouter';
export { default as DrawerRouter, DrawerActions, DrawerActionType, DrawerRouterOptions, DrawerNavigationState } from './DrawerRouter';
export * from './types';
//# sourceMappingURL=index.js.map

node_modules/@react-navigation/routers/lib/module/index.js之后:

import * as CommonActions from './CommonActions';
export { CommonActions };
export { default as BaseRouter } from './BaseRouter';
export { default as StackRouter, StackActions } from './StackRouter';
export { default as TabRouter, TabActions } from './TabRouter';
export { default as DrawerRouter, DrawerActions } from './DrawerRouter';
export * from './types';
//# sourceMappingURL=index.js.map

I am developing a mobile app using react native Expo. I used the React Navigation version 5.x and getting the following warnings:

web Compiled with warnings.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'DrawerActionType' is not exported from './DrawerRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'DrawerNavigationState' is not exported from './DrawerRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'DrawerRouterOptions' is not exported from './DrawerRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'StackActionType' is not exported from './StackRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'StackNavigationState' is not exported from './StackRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'StackRouterOptions' is not exported from './StackRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'TabActionType' is not exported from './TabRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'TabNavigationState' is not exported from './TabRouter'.

D:/_expo/navi/node_modules/@react-navigation/routers/lib/module/index.js Attempted import error: 'TabRouterOptions' is not exported from './TabRouter'.

Please guide.

解决方案

Remove imports that are not being exported from the file.

From what I saw StackRouter, TabRouter and DrawerRouter follow the same pattern and have not exported imports that have the endings: ActionType, RouterOptions and NavigationState.

I don't know if the Expo leaves these imports for later when it includes them on account of the SDK or something that escapes my knowledge, I made the change here and my project continued to run normally without these Yellow Boxes.

node_modules/@react-navigation/routers/lib/module/index.js BEFORE:

import * as CommonActions from './CommonActions';
export { CommonActions };
export { default as BaseRouter } from './BaseRouter';
export { default as StackRouter, StackActions, StackActionType, StackRouterOptions,         StackNavigationState } from './StackRouter';
export { default as TabRouter, TabActions, TabActionType, TabRouterOptions, TabNavigationState } from './TabRouter';
export { default as DrawerRouter, DrawerActions, DrawerActionType, DrawerRouterOptions, DrawerNavigationState } from './DrawerRouter';
export * from './types';
//# sourceMappingURL=index.js.map

node_modules/@react-navigation/routers/lib/module/index.js AFTER:

import * as CommonActions from './CommonActions';
export { CommonActions };
export { default as BaseRouter } from './BaseRouter';
export { default as StackRouter, StackActions } from './StackRouter';
export { default as TabRouter, TabActions } from './TabRouter';
export { default as DrawerRouter, DrawerActions } from './DrawerRouter';
export * from './types';
//# sourceMappingURL=index.js.map

这篇关于如何删除到达导航5.x警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆