无法解析 "./elements/Marker" - 有人能告诉我哪里出了问题吗?
Unable to resolve "./elements/Marker" - can somebody tell me what's wrong?
我的 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.. 安装了它,但它没有给我最新版本。现在我已经手动更新它并且它起作用了。
我的 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.. 安装了它,但它没有给我最新版本。现在我已经手动更新它并且它起作用了。