React Native 在我的 Android 设备上是空白的。它只是一个带有谷歌 Logo 的灰色屏幕。 不像React-native-maps Blank page Only google logo它可以在模拟器上运行,但不能在真实设备上运行。
我在网上搜索了这个问题:
- API 应该没问题
- 样式表没问题
- 它正在 genymotion 模拟器上运行
在 Android 虚拟设备上工作
在 Expo 上工作得很好,但当我从 Playstore 下载该应用程序时却不行。 AndroidManifest.xml 中的元数据如下所示:
这就是 map View 的样子:
` <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,
},`
最佳答案
如果所有其他方法都失败了,就像我的情况一样,请不要忘记基本的东西。原来我没有在 console.developers.google.com 中启用“Maps SDK for Android”
关于google-maps - Android 设备上的 React-native-maps 空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51378088/