53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { StatusBar } from 'expo-status-bar';
|
|
import { StyleSheet, Text, View } from 'react-native';
|
|
import { NavigationContainer } from '@react-navigation/native';
|
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
import MapScreen from './src/screens/MapScreen'
|
|
import ListScreen from './src/screens/ListScreen';
|
|
import * as Location from "expo-location"
|
|
import { useEffect } from 'react';
|
|
|
|
const Stack = createStackNavigator();
|
|
|
|
|
|
let foregroundSubscription = null;
|
|
|
|
|
|
export default function App() {
|
|
|
|
const foregroundUpdate = async() =>{
|
|
const {granted} = await Location.getForegroundPermissionsAsync()
|
|
if (!granted){
|
|
console.error("Permissão Não obtida para localização")
|
|
return
|
|
}
|
|
}
|
|
useEffect(()=>{
|
|
const locationPerm = async() =>{
|
|
const foregroun = await Location.requestForegroundPermissionsAsync()
|
|
}
|
|
locationPerm()
|
|
foregroundUpdate()
|
|
|
|
},[]
|
|
|
|
)
|
|
return (
|
|
<NavigationContainer>
|
|
<Stack.Navigator>
|
|
<Stack.Screen name="MapScreen" component={MapScreen} />
|
|
<Stack.Screen name="ListScreen" component={ListScreen} />
|
|
</Stack.Navigator>
|
|
</NavigationContainer>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: '#fff',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
});
|