React-Native Map App

React-Native Map App

DATE POSTED:4/14/2026

Create the app

With Expo:

bashnpx create-expo-app my-map-app cd my-map-app npx expo install react-native-maps npx expo install expo-location npm start

3. Core features your app needs

Your app’s first version should probably include:

4. Basic map screen example

Here’s a simple starter example:

import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Alert } from 'react-native';
import MapView, { Marker } from 'react-native-maps';
import * as Location from 'expo-location';

export default function App() {
  const [region, setRegion] = useState(null);
  const [pins, setPins] = useState([]);

  useEffect(() => {
    (async () => {
      let { status } =
        await Location.requestForegroundPermissionsAsync();

      if (status !== 'granted') {
        Alert.alert(
          'Permission denied',
          'Location access is needed to show your position.'
        );
        return;
      }

      let location = await Location.getCurrentPositionAsync({});

      setRegion({
        latitude: location.coords.latitude,
        longitude: location.coords.longitude,
        latitudeDelta: 0.05,
        longitudeDelta: 0.05,
      });
    })();
  }, []);

  const handleMapPress = (event) => {
    const { coordinate } = event.nativeEvent;

    setPins((prevPins) => [
      ...prevPins,
      {
        id: Date.now().toString(),
        latitude: coordinate.latitude,
        longitude: coordinate.longitude,
      },
    ]);
  };

  if (!region) {
    return <View style={styles.container} />;
  }

  return (
    <View style={styles.container}>
      <MapView
        style={styles.map}
        initialRegion={region}
        onPress={handleMapPress}
        showsUserLocation
      >
        {pins.map((pin) => (
          <Marker
            key={pin.id}
            coordinate={{
              latitude: pin.latitude,
              longitude: pin.longitude,
            }}
          />
        ))}
      </MapView>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },

  map: {
    flex: 1,
  },
});

5. What this does

6. Next things you’ll likely want

After this basic version, add:

Save pins locally

Use AsyncStorage:

bashnpx expo install @react-native-async-storage/async-storage

Then save/load the pins array.

Add pin details

Each pin could include:

Let users delete or edit pins

You can show a modal when a marker is pressed.

Use a backend

If you want syncing across devices, use:

7. Important map setup notes

Depending on platform, maps may need extra setup:

If you use Expo, much of this is simpler, but you should still check:

8. A simple app structure

A clean starter structure could be:

bashmy-map-app/ components/
MapScreen.js
PinModal.js
services/
storage.js
App.js

9. Recommended MVP

A very practical minimum version: