Fla*_*rea 8 javascript react-native expo
我目前正在尝试使用 React-Native 和 Expo 用 MapView 组件构建一个小东西。
虽然当我在 Expo Go 中扫描 Expo QR 码时,Google 地图可以完美地显示在我的手机上,但我只是稍微修改了我的代码,只是修改了地图窗口的尺寸 - 这可能就是导致这种情况的原因,因为我这样做可能是错的,尽管我非常怀疑。
这是到目前为止我的代码(我只使用了 App.js 文件):
import { StatusBar } from 'expo-status-bar';
import * as React from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import MapView from 'react-native-maps';
export default function App() {
return (
<View style={styles.container}>
<MapView style={styles.map} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
map: {
width: Dimensions.get('window').width,
height: Dimensions.get('window' - 10).height,
},
});
Run Code Online (Sandbox Code Playgroud)
我的终端中显示的错误是:
Cannot connect to the Metro server.
Run Code Online (Sandbox Code Playgroud)
请尝试以下方法来解决该问题:
网址:10.1.5.81:19000
归档时间: |
|
查看次数: |
12091 次 |
最近记录: |