Anonymous
SVG не работают в приложении Expo Android с использованием React-Cnive-SVG
Сообщение
Anonymous » 07 сен 2025, 00:26
Я пытаюсь использовать значки SVG в моем приложении Android React (Hunning Expo). Я пробовал очистить сборки, начинать свежо, но это совсем не работает. Вот пример исходного кода, который я использовал, package.json и скриншот появляющейся ошибки.
Код: Выделить всё
import Svg, { Circle } from 'react-native-svg'
< /code>
< /div>
< /div>
< /p>
Это мой пакет.{
"name": "********",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"lint": "expo lint",
"format": "prettier --write **/*.{js,ts,tsx,json}"
},
"dependencies": {
"@expo/vector-icons": "^14.1.0",
"@react-native-async-storage/async-storage": "2.1.2",
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/elements": "^2.3.8",
"@react-navigation/native": "^7.1.6",
"expo": "~53.0.22",
"expo-blur": "~14.1.5",
"expo-constants": "~17.1.7",
"expo-dev-client": "~5.2.4",
"expo-haptics": "~14.1.4",
"expo-image": "~2.4.0",
"expo-linking": "~7.1.7",
"expo-router": "~5.1.5",
"expo-splash-screen": "~0.30.10",
"expo-status-bar": "~2.2.3",
"expo-symbols": "~0.4.5",
"expo-system-ui": "~5.0.11",
"expo-web-browser": "~14.2.0",
"lucide-react-native": "^0.542.0",
"prettier": "^3.6.2",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-native": "0.79.5",
"react-native-gesture-handler": "~2.24.0",
"react-native-mmkv": "^3.3.1",
"react-native-nitro-modules": "^0.29.3",
"react-native-reanimated": "~3.17.4",
"react-native-safe-area-context": "5.4.0",
"react-native-screens": "~4.11.1",
"react-native-web": "~0.20.0",
"react-native-webview": "13.13.5",
"react-native-worklets": "^0.5.0",
"react-native-svg": "15.11.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@types/react": "~19.0.10",
"eslint": "^9.25.0",
"eslint-config-expo": "~9.2.0",
"typescript": "~5.8.3"
},
"private": true
}
И это ошибка, с которой я сталкиваюсь:
/>ViewManagerREsolver returned null for either RNSVGViewAndroid or RCTRNSVGSvgViewAndroid
< /code>
Это также моя конфигурация Metro < /p>
const { getDefaultConfig } = require('expo/metro-config');
module.exports = (() => {
const config = getDefaultConfig(__dirname);
// For inline SVG components, use default configuration
return config;
})();< /code>
< /div>
< /div>
< /p>
и моя конфигурация Babel < /p>
Подробнее здесь:
https://stackoverflow.com/questions/797 ... native-svg
1757193990
Anonymous
Я пытаюсь использовать значки SVG в моем приложении Android React (Hunning Expo). Я пробовал очистить сборки, начинать свежо, но это совсем не работает. Вот пример исходного кода, который я использовал, package.json и скриншот появляющейся ошибки.[code]import Svg, { Circle } from 'react-native-svg' < /code> < /div> < /div> < /p> Это мой пакет.{ "name": "********", "main": "expo-router/entry", "version": "1.0.0", "scripts": { "start": "expo start", "reset-project": "node ./scripts/reset-project.js", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", "lint": "expo lint", "format": "prettier --write **/*.{js,ts,tsx,json}" }, "dependencies": { "@expo/vector-icons": "^14.1.0", "@react-native-async-storage/async-storage": "2.1.2", "@react-navigation/bottom-tabs": "^7.3.10", "@react-navigation/elements": "^2.3.8", "@react-navigation/native": "^7.1.6", "expo": "~53.0.22", "expo-blur": "~14.1.5", "expo-constants": "~17.1.7", "expo-dev-client": "~5.2.4", "expo-haptics": "~14.1.4", "expo-image": "~2.4.0", "expo-linking": "~7.1.7", "expo-router": "~5.1.5", "expo-splash-screen": "~0.30.10", "expo-status-bar": "~2.2.3", "expo-symbols": "~0.4.5", "expo-system-ui": "~5.0.11", "expo-web-browser": "~14.2.0", "lucide-react-native": "^0.542.0", "prettier": "^3.6.2", "react": "19.0.0", "react-dom": "19.0.0", "react-native": "0.79.5", "react-native-gesture-handler": "~2.24.0", "react-native-mmkv": "^3.3.1", "react-native-nitro-modules": "^0.29.3", "react-native-reanimated": "~3.17.4", "react-native-safe-area-context": "5.4.0", "react-native-screens": "~4.11.1", "react-native-web": "~0.20.0", "react-native-webview": "13.13.5", "react-native-worklets": "^0.5.0", "react-native-svg": "15.11.2" }, "devDependencies": { "@babel/core": "^7.25.2", "@types/react": "~19.0.10", "eslint": "^9.25.0", "eslint-config-expo": "~9.2.0", "typescript": "~5.8.3" }, "private": true }[/code] И это ошибка, с которой я сталкиваюсь: />ViewManagerREsolver returned null for either RNSVGViewAndroid or RCTRNSVGSvgViewAndroid < /code> Это также моя конфигурация Metro < /p> const { getDefaultConfig } = require('expo/metro-config'); module.exports = (() => { const config = getDefaultConfig(__dirname); // For inline SVG components, use default configuration return config; })();< /code> < /div> < /div> < /p> и моя конфигурация Babel < /p> Подробнее здесь: [url]https://stackoverflow.com/questions/79757749/svgs-not-working-in-expo-android-app-using-react-native-svg[/url]