React Naitve错误-永久违反:ART已从React Native中删除

时间:2020-06-03 11:59:02

标签: react-native react-native-android

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.

2 个答案:

答案 0 :(得分:1)

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

react-native-progress的文档所述。

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

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

Note: If you don't want the ReactART based components and it's dependencies, do a deep require instead: 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.

答案 1 :(得分:0)

任何依赖于ART的软件包都会引起您的问题,不仅会导致 react-native-progress ,还会导致带有诸如 react-native-loading-spinner-overlay < / strong>, 您可以通过修改进口商品的另一包来更改此商品

Art库已从SDK 36删除, 如果您需要使用依赖于ART的react-native-progress,则可以使用裸流程并安装@react-native-community/art,或使用Svg

来实现自己的进度指示器