如何避免这种警告?
我的应用程序正在工作,但它在终端中发出警告,如下所示
Compiled with warnings.
/home/karim/Desktop/React-Native/RN-Complete-Guide/node_modules/react-navigation-header-
buttons/src/overflowMenuPressHandlers.js
Attempted import error: 'ActionSheetIOS' is not exported from 'react-native-web/dist/index'.
因为我从react-navigation-header-buttons
导入了HeaderButtons
和HeaderButton
,如下所示
import { HeaderButtons } from "react-navigation-header-buttons";
import { HeaderButton } from "react-navigation-header-buttons";
我使用的是react-native 4.x veriosn。
有什么方法可以避免这个警告吗?
发布于 2021-06-24 03:17:21
react-navigation-header-buttons
源代码中的This file导入ActionSheetIOS
,即not supported by React Native web applications。这似乎是React Native web本身的一个问题,因为即使在你的项目中导入ActionSheetIOS
组件而不实际使用它,根据我过去的经验,也会导致崩溃。
由于这个问题,您可能无法将react-navigation-header-buttons
用于您的解决方案。作者还说,in their README目前对web的支持还处于实验阶段:
支持iOS和安卓系统,web支持是试验性的。
我建议要么找到一种方法来避免这个库,要么在代码库上标记一个问题,建议用像react-native-action-sheet
这样的跨平台动作单解决方案来交换ActionSheetIOS
。
发布于 2021-07-23 16:39:58
在react-native-web/dist/index.js中,我导出了导出{ ActionSheetIOS };不知何故,警告消失了
https://stackoverflow.com/questions/67450055
复制相似问题