我的 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>
);
}
}