ART是从react-native-progress模块中的'react-native'导入的。
import { Animated, ART, StyleSheet, View } from 'react-native';
我更新了模块,现在它从@react-native-communityart导入。
import { Surface as ARTSurface } from '@react-native-community/art';
ART没有在项目中的其他地方使用,但我仍然面临着同样的错误。
错误信息:违反不变性。ART已经从React Native中移除。现在可以从'@react-native-communityart'而不是'react-native'安装和导入。请看 https:/github.comreact-native-communityart。.
通过查看你的堆栈,你正在使用react-native-progress,这是它的一个内部依赖,这就是为什么你面临这个问题。
根据 react-native-progress 的文档。
https:/github.comobladorreact-native-progressblobmasterREADME.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.