小编per*_*n66的帖子

不变违规:requireNativeComponent:在 UIManager 中找不到“RNSVGSvgViewAndroid”

我对标题中提到的错误感到头疼。\n我正在使用react-native-gifted-charts(https://www.npmjs.com/package/react-native-gifted-charts/v/1.0.3)\n图表在 ios 中完美运行,但在 Android 中它不断崩溃并抛出“Invariant Violation: requireNativeComponent: 在 UIManager 中找不到“RNSVGSvgViewAndroid”。”\n首先我认为这是我的代码的问题,因为它之前适用于 Android ,但即使我反转代码,错误仍然存​​在。\n我正在使用yarn作为包管理器和Expo托管工作流程。\n依赖项如下。

\n
"react-native": "0.70.5",\n"react-native-gifted-charts": "^1.2.42",\n"react-native-linear-gradient": "2.6.2",\n"react-native-svg": "12.1.0",\n\n
Run Code Online (Sandbox Code Playgroud)\n

\xe2\x96\xa0我尝试过的事情

\n
    \n
  1. 我删除了节点模块并再次运行yarn \xe2\x86\x90 不起作用
  2. \n
  3. 我更改了react-native-svg的版本,正如我在下面的文章中读到的那样,有时这种错误是由于版本不匹配而发生的。\xe2\x86\x90没有\n工作\n https://github 。 com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/263
  4. \n
  5. 我删除了react-native-gifted-chartsreact-native-linear-gradientreact-native-svg并再次添加了yarn以查看它是否解决了问题。\xe2\x86\x90 不起作用
  6. \n
  7. 最后,为了确认我的代码不是问题,我删除了所有代码并制作了一个简单的 barChart 示例来查看它是否有效(下面的示例代码) \xe2\x86\x90 没有工作
  8. \n
\n
import React, { useState } from "react";\nimport { View, StyleSheet, Text, TouchableOpacity, ScrollView } from "react-native";\nimport type { NativeStackScreenProps } from "@react-navigation/native-stack";\nimport { MainStackParamList } from "../types/navigation";\nimport dayjs from "dayjs";\nimport { BarChart, LineChart, PieChart } from "react-native-gifted-charts";\nimport …
Run Code Online (Sandbox Code Playgroud)

android typescript react-native expo-go

19
推荐指数
4
解决办法
2万
查看次数

标签 统计

android ×1

expo-go ×1

react-native ×1

typescript ×1