-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
42 lines (34 loc) · 1.05 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, {Component} from 'react';
import {View, StyleSheet, Platform } from 'react-native';
import MapboxGL from '@mapbox/react-native-mapbox-gl';
import Title from './src/components/Title';
import LocationInput from './src/components/LocationInput';
import WhizzMap from './src/components/WhizzMap';
const IS_ANDROID = Platform.OS === 'android';
//Create a component
export default class App extends Component {
constructor (props) {
super(props);
this.state = {
isFetchingAndroidPermission: IS_ANDROID,
isAndroidPermissionGranted: false,
}
}
async componentWillMount(){
if (IS_ANDROID) {
const isGranted = await MapboxGL.requestAndroidLocationPermissions();
this.setState({
isAndroidPermissionGranted: isGranted,
isFetchingAndroidPermission: false,
});
}
}
render(){
return (
<View style={{ flex: 1}}>
<Title titleText={'Whizz Map'} />
<WhizzMap />
</View>
);
}
}