【发布时间】:2018-07-17 09:41:45
【问题描述】:
React Native 在我的安卓设备上是空白的。它只是一个带有谷歌标志的灰色屏幕。 与React-native-maps Blank page Only google logo 不同的是,它是在模拟器上工作,而不是在真实设备上。
我在网上搜索了问题:
- API 应该没问题
- 样式表没问题
- 它正在开发 genymotion 模拟器
-
在安卓虚拟设备上工作
在 Expo 上完美运行,但当我从 Playstore 下载应用程序时却不行。 AndroidManifest.xml 中的元数据如下所示:
这就是 mapView 的样子:
` <MapView showsUserLocation={false} style={styles.map} provider='google' ref={ref => { map3 = ref; }} onMapReady = { this.onMapReady } initialRegion={this.state.region} > <Marker image={logo} coordinate={this.state.coordinate} /> </MapView>`
.. 和风格:
`const styles = StyleSheet.create({
mapContainer: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#ecf0f1',
},
map: {
flex: 1,
borderRadius: 4,
width,
height,
zIndex: 1,
},`
【问题讨论】:
-
+1。这个问题帮助了我:|我只是忘了把 flex 放在样式中,所以地图正在加载但没有显示在屏幕上,因为 mapview 没有采用高度或宽度。我知道这是一个很小的错误。我把它放在这里是因为也许这可以帮助像我这样的初学者:|
标签: google-maps react-native react-native-maps