React Native 错误 - 不变违规:ART 已从 React Native 中删除
React Naitve Error - Invariant Violation: ART has been removed from React Native
ART 是从 'react-native' 导入的 react-native-progress 模块。
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
因此根据文档,您也可以将其删除以修复此错误。
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.
任何依赖 ART 的包都会导致你的问题,不仅是 react-native-progress,还有像这样的加载程序的包 react-native-loading-spinner-overlay,
您可以通过修复导入
找到另一个包来更改此设置
艺术库已从 SDK 36 中移除,
如果您需要使用依赖于 ART 的 react-native-progress,您可以使用裸工作流程并安装 @react-native-community/art,或者使用 Svg
实现您自己的进度指示器
ART 是从 'react-native' 导入的 react-native-progress 模块。
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
因此根据文档,您也可以将其删除以修复此错误。
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.
任何依赖 ART 的包都会导致你的问题,不仅是 react-native-progress,还有像这样的加载程序的包 react-native-loading-spinner-overlay, 您可以通过修复导入
找到另一个包来更改此设置艺术库已从 SDK 36 中移除, 如果您需要使用依赖于 ART 的 react-native-progress,您可以使用裸工作流程并安装 @react-native-community/art,或者使用 Svg
实现您自己的进度指示器