L_O*_*L_O 5 google-chrome reactjs react-native expo
我正在尝试React Native <Image source={require('./assets/favicon.png')} /> 根据Docs Static Image Resources找出图像和网络图像:
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View, SafeAreaView, Image } from 'react-native';
export default function App() {
return (
<SafeAreaView style={styles.container}>
<Text>App</Text>
<Image source={require('./assets/favicon.png')} />
</SafeAreaView>
);
}
Run Code Online (Sandbox Code Playgroud)
Expo Clienticon.png在设备上显示默认值,但在Chrome浏览器控制台中显示Image: /static/media/favicon.608e4d9d.png,更新文本和背景颜色,但没有出现图像,即使是默认图标,在控制台中显示此内容,不确定是否相关:
没有触摸开始就不能记录触摸结束。触摸结束:{"identifier":0,"pageX":709,"pageY":185,"timestamp":1807.07999999986775} 触摸银行:[]
使用网络图像在带有Expo Clientforhttps://reactjs.org/logo-og.png或随机图片https://picsum.photos/200/300链接的设备上运行良好:
<Image source={{uri: 'https://picsum.photos/200/300'}}
style={{width: 400, height: 400}} />
Run Code Online (Sandbox Code Playgroud)
但屏幕上没有任何大小相同甚至小于 15.7 KB 图像的 GitHub 链接,例如:
https://github.com/mygithub/myproject/blob/master/img/myimage.png
我的Node.js版本是 14.15.1,这是应用程序package.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~39.0.2",
"expo-status-bar": "~1.0.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz",
"react-native-web": "~0.13.12"
},
"devDependencies": {
"@babel/core": "~7.9.0"
},
"private": true
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
156 次 |
| 最近记录: |