Реактивная карта не отображается - PullRequest
0 голосов
/ 10 октября 2018

Я пытаюсь использовать air-bnb-реактивные-родные карты для моего приложения-нативного приложения, но карта не отображается на устройстве.При установке модуля следуйте инструкциям, указанным в документации ( здесь ).Также разрешения добавляются в приложение в файле AndroidManifest.

Файл build.gradle

buildscript {
ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 16
    compileSdkVersion = 27
    targetSdkVersion = 26
    supportLibVersion = "27.1.1"
    googlePlayServicesVersion = "11.8.0"
    androidMapsUtilsVersion = "0.5+"
    }
repositories {
    jcenter()
    google()
    }
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
  }
}

добавляется следующей версией в файл bilde.gradle внутри исходной папки

dependencies {
    implementation project(':react-native-maps')
}

Файл App.js

 import React, {Component} from 'react';
 import {AppRegistry, Text, View} from 'react-native';
 import Component6 from './app/components/Component6/Component6'
 import UsersMap from './app/components/Component6/UsersMap'

 export default class App extends Component {

 getLocationHandler = () => { 
  navigator.geolocation.getCurrentPosition(position => {
    console.log(position);
    }, err =>  console.log(err));
 }

 render() {
    return (
       <View>
         <Component6 onGetLocation={this.getLocationHandler} />
          <UsersMap />
       </View>
     );
   } 
 }


 AppRegistry.registerComponent('App', () => App);

Файл Component6.js

import React from 'react';
import {Button} from 'react-native';

const fetchLocation = props => {
    return(
        <Button title="Get Location" onPress = {props.onGetLocation} 
          />
        );
    };
  export default fetchLocation;

Файл UsersMap.js

import React from 'react';
import {View, StyleSheet} from 'react-native';
import MapView from 'react-native-maps';

const usersMap = props => {
     return(
          <View styles={styles.mapContainer}>
                <MapView styles={styles.map}/>
          </View>
      );
  };

const styles = StyleSheet.create({
   mapContainer : {
      width : '100%',
      height : 200
    },
   map : {
      width : '100%',
      height : '100%'
    }
  });
export default usersMap;

navigator.geolocation.getCurrentPosition возвращает текущее местоположение на консоль, но карта не являетсяпоказывая на устройстве.Любой совет будет оценен.

...