小编Сто*_*ков的帖子

React-native-maps空白页仅Google徽标

我一直在尝试将Google Maps安装为react-native一周,但仍然没有成功。我已经搜索并尝试了react-native-maps github问题中的解决方案,但仍然出现空白页。

我所做的:

react-native init myapp
npm install
yarn add react-native-maps
react-native link react-native-maps
Run Code Online (Sandbox Code Playgroud)

在Google Console API中->创建新项目->启用Google Maps Android API,Google Maps JavaScript API和Places API->创建凭据

在AndroidManifest.xml中

    <application>
....
       <meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="AIzaSyDRK50sPCRCPLTnyt0OUdng9cwP0eqPJq4"/>
    </application>
Run Code Online (Sandbox Code Playgroud)

package.json

    {
    "name": "maps",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.0.0",
        "react-native": "0.50.4",
        "react-native-maps": "^0.18.3"
    },
    "devDependencies": {
        "babel-jest": "21.2.0",
        "babel-preset-react-native": "4.0.0",
        "jest": "21.2.1",
        "react-test-renderer": "16.0.0"
    },
    "jest": {
        "preset": "react-native"
    }
}
Run Code Online (Sandbox Code Playgroud)

App.js

import React, { Component …
Run Code Online (Sandbox Code Playgroud)

android google-maps react-native-android react-native-maps

6
推荐指数
4
解决办法
5206
查看次数