Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
'React Native' select location using native maps

I need user to select location of an event.

Now what already works is opening the native maps (at least on android) - I can open the native maps through { Linking } from "react-native"; geo:24.669026,24.699024?z=6

However what I can't find how to make native maps prompt user to set some location and after some kind of confirmation?

I imagined something like return_url with some sort of backlink to my application.

Or is this ONLY possible through embeding maps and using Google Maps API?

(I am trying to avoid billing, since all I want to do is to help user to find the coordinates and put them back to application, the application doesn't use the coordinates to do anything besides sending user to display them on they native maps)

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

so if I understood you correctly you want to show the user's current location on the map without paying to any third party, if that's the case you need to do the followings.

  1. Get user latitude and longitude.
  2. Show those latitudes and longitudes on the map using some marker.

1. Get user latitude and longitude.

You can follow the below article for getting user latitude and longitude.

  • ReactNative: https://aboutreact.com/react-native-geolocation/
  • Expo: https://docs.expo.dev/versions/latest/sdk/location

2. Show those latitudes and longitudes on the map using some marker.

So in this step, we will be using react-native-maps and OpenStreetMap.

Note: Do not change urlTemplate in the UrlTile

Here is the reference for custom map tile from react-native-maps

https://github.com/react-native-maps/react-native-maps#tile-overlay-using-tile-server

import MapView, { UrlTile, Marker } from "react-native-maps";

const { width, height } = props;
const ASPECT_RATIO = width / height;
const LATITUDE_DELTA = 8; //Very high zoom level
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
const userCoords={{
   latitude: number,
   longitude: number
}};
<MapView
  initialRegion={{
    latitude: 51.1657,
    longitude: 10.4515,
    latitudeDelta: LATITUDE_DELTA,
    longitudeDelta: LONGITUDE_DELTA,
  }}
  loadingEnabled
  minZoomLevel={3}
  maxZoomLevel={10}
  showsIndoors={false}
  showsTraffic={false}
  showsBuildings={false}
  showsScale={true}
>
  <UrlTile
    /**
     * The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
     * For example, http://c.tile.openstreetmap.org/{z}/{x}/{y}.png
     */
    urlTemplate={"http://c.tile.openstreetmap.org/{z}/{x}/{y}.png"}
    /**
     * The maximum zoom level for this tile overlay. Corresponds to the maximumZ setting in
     * MKTileOverlay. iOS only.
     */
    maximumZ={10}
    /**
     * flipY allows tiles with inverted y coordinates (origin at bottom left of map)
     * to be used. Its default value is false.
     */
    flipY={false}
  />
  <Marker coordinate={userCoords}>
    /**
     * Your custom marker here 
    */
  </Marker>
</MapView>;
about 4 years ago · Juan Pablo Isaza Relatório

0

You currently can't do that with react-native, you have to add your own map. You can use react-native-maps

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda