简体   繁体   中英

Android react-native showsMyUserLocation doesn't appear

I have the following code in my./src/index.js:

import React from 'react';
import MapView from 'react-native-maps';

import {View} from 'react-native';

const App = () => (
  <View style={{flex: 1}}>
    <MapView
      style={{flex: 1}}
      region={{
        latitude: -27.210753,
        longitude: -49.644183,
        latitudeDelta: 0.00143,
        longitudeDelta: 0.00035,
      }}
      showsUserLocation={true}
      showsMyLocationButton={true}
      loadingEnabled
    />
  </View>
);

export default App;

I can't see showsUserLocation, showsMyLocationButton. Otherwise, I can see map and my place with coordinates that I put.

Please, need I do something else?

Your location of your phone is probably not turned on. If you are using android, try going into google maps on phone and check if you are able to see your location. If you are not able to see your location:

Go to More > Location. Enter your lat-long > Press SEND

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM