我正在开发一款名为Reaction Native EXPO的应用程序,但遇到一条警告,指出它在特定路径下找不到图像文件.警告消息提到以下路径:
WARN Could not find image file:///Users/[USERNAME]/Library/Developer/CoreSimulator/Devices/F8428037-7C3C-4084-8236-2357D1AF4D42/data/Containers/Bundle/Application/5C0D625D-94E4-465A-9613-405D666B4E79/Exponent-2.28.9.tar.app/./assets/story2.jpg
代码:
const stories = ['story1.jpg', 'story2.jpg', 'story3.jpg', 'story4.jpg', 'story1.jpg', 'story1.jpg'];
<StoriesView stories={stories} />
const StoriesView = ({ stories }) => {
return (
<ScrollView horizontal showsHorizontalScrollIndicator={false} style={styles.storiesScrollView}>
<View style={styles.storiesContainer}>
{stories.map((name, index) => (
<Image
key={index}
style={styles.storyImage}
source={{ uri: `./assets/${name}` }}
/>
))}
</View>
</ScrollView>
);
};
我已经验证了路径并确保图像文件存在,但警告仍然存在.有人能就如何排除故障和解决此问题提供建议吗?我正在使用Reaction Native EXPO.
任何帮助或见解都将不胜感激.谢谢!