android - 无法解析“./elements/Marker” - 有人可以告诉我出了什么问题吗?
问题描述
我的 SVG 组件有问题。我认为我已经正确完成了所有操作,但是在编译后我不断收到此错误:
Unable to resolve "./elements/Marker" from "node_modules\react-native-svg\src\ReactNativeSVG.ts"
Failed building JavaScript bundle.
有人可以检查我在下面提供的代码并告诉我出了什么问题吗?我目前正在开发最新的 Expo SDK 和 react-native-svg 包。哦,还有一件更重要的事情要说……我已经在 Expo-Snack 中对其进行了测试,它确实有效!
import React, { Component } from 'react';
import { View, StyleSheet, Dimensions } from 'react-native';
import Svg, { Defs, RadialGradient, Stop, G, Use, Path } from 'react-native-svg';
const { height, width } = Dimensions.get('window');
export default class SvgRadialBackground extends Component {
render() {
return (
<View
style={[
StyleSheet.absoluteFill,
{ alignItems: 'center', justifyContent: 'center' },
]}>
<Svg width={width} height={height}>
<Defs>
<RadialGradient
cx="50%"
cy="14%"
fx="50%"
fy="25%"
r="177%"
gradientTransform="matrix(0 .5 -1 0 .5 -0.146)"
id="prefix__b"
>
<Stop stopColor="#FFF" stopOpacity={0.5} offset="0%" />
<Stop stopColor="#003232" offset="100%" />
</RadialGradient>
<Path id="prefix__a" d="M0 0h375v667H0z" />
</Defs>
<G fill="none" fillRule="evenodd">
<Use fill="#244F77" xlinkHref="#prefix__a" />
<Use
fill="url(#prefix__b)"
style={{
mixBlendMode: 'soft-light',
}}
xlinkHref="#prefix__a"
/>
<Use stroke="#979797" xlinkHref="#prefix__a" />
</G>
</Svg>
</View>
);
}
}
解决方案
我想通了..这个无法解决的标记是一个新功能,他们实际上在几天前更新了包。我已经使用 expo install 安装了它。它没有给我最新版本。现在我已经手动更新了它并且它有效。
推荐阅读
- android - Android:TabLayout UI 闪烁/闪烁问题
- django - DRF APIView - 如何将帮助文本添加到自动生成的表单?
- ios - 如何以编程方式快速了解最新的 ios 版本?
- pandas - 无法在 AWS Lambda 中导入 lambda_handler
- twilio - 从未调用 Twilio 录制状态回调
- python - 给定2个坐标,在它们之间画一条线
- python - 如何修复不是 CountVectorizer - 未安装词汇表。在烧瓶中部署 ml 模型时
- asp.net - 如何使用 ASP.net MVC 使用具有 oauth2 授权的 Web api?
- python - 如何在 python 中将 ndarray 呈现给训练有素的 caffe 网络?
- assembly - “PTR”和“NEAR PTR”有什么区别?