- We'll start by opening App.js and adding our imports:
import React from 'react';import { Location, Permissions, MapView, Marker} from 'expo';import { StyleSheet, Text, View,} from 'react-native';
- Next, let's define the App class and the initial state. In this recipe, state will only need to keep track of the user's location, which we initialize to null:
export default class App extends Component { state = { location: null } // Defined in following steps}
- Next, we'll define the componentDidMount life cycle hook, which will ask the user to grant permission to access the user's location via the device's geolocation. If the user grants the app permission to use its location, the return object will have a status property with ...