gpt4 book ai didi

react-native - React Native 错误 - 不变违规 : ART has been removed from React Native

转载 作者:行者123 更新时间:2023-12-05 02:53:33 25 4
gpt4 key购买 nike

ART 是从 react-native-progress 模块中的“react-native”导入的。

import { Animated, ART, StyleSheet, View } from 'react-native';

我更新了模块,现在它是从@react-native-community/art 导入的。

import { Surface as ARTSurface } from '@react-native-community/art';

项目中其他地方都没有使用ART,但我仍然面临同样的错误。知道出了什么问题吗?

错误信息:不变违规:ART 已从 React Native 中移除。现在可以从“@react-native-community/art”而不是“react-native”安装和导入它。参见 https://github.com/react-native-community/art .

Screenshot of the error.

最佳答案

通过查看堆栈跟踪,您正在使用 react-native-progress,这是它​​的内部依赖项,这就是您面临此问题的原因。

根据 react-native-progress 的文档。

https://github.com/oblador/react-native-progress/blob/master/README.md#reactart-based-components

因此根据文档,您也可以删除它以修复此错误。

注意:如果您不想要基于 ReactART 的组件及其依赖项,请改为执行深度要求:import ProgressBar from 'react-native-progress/Bar';。

因此,您可以避免使用这些基于 ART 的组件,或者尝试像下面那样修复它们。

in file Circle.js, CircleSnail.js, Pie.js,
replace ART.Surface with
import {Surface} from '@react-native-community/art';
and in file Shapes/Arc.js
import {Shape, Path} from '@react-native-community/art';
and replace the same above.

关于react-native - React Native 错误 - 不变违规 : ART has been removed from React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62172332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com