forked from vergnet/application-amicale
Added basic map
This commit is contained in:
parent
7464ef8859
commit
211e57167d
4 changed files with 82 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
"@react-native-community/masked-view": "^0.1.10",
|
"@react-native-community/masked-view": "^0.1.10",
|
||||||
"@react-native-community/push-notification-ios": "^1.1.1",
|
"@react-native-community/push-notification-ios": "^1.1.1",
|
||||||
"@react-native-community/slider": "^3.0.0",
|
"@react-native-community/slider": "^3.0.0",
|
||||||
|
"@react-native-mapbox-gl/maps": "^8.1.0-rc.1",
|
||||||
"@react-navigation/bottom-tabs": "^5.3.2",
|
"@react-navigation/bottom-tabs": "^5.3.2",
|
||||||
"@react-navigation/native": "^5.2.2",
|
"@react-navigation/native": "^5.2.2",
|
||||||
"@react-navigation/stack": "^5.2.17",
|
"@react-navigation/stack": "^5.2.17",
|
||||||
|
|
|
@ -30,6 +30,7 @@ import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
|
||||||
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
|
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
|
||||||
import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
|
import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
|
||||||
import BugReportScreen from "../screens/Other/FeedbackScreen";
|
import BugReportScreen from "../screens/Other/FeedbackScreen";
|
||||||
|
import MapScreen from "../screens/Services/MapScreen";
|
||||||
|
|
||||||
const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
|
const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
|
||||||
|
|
||||||
|
@ -106,6 +107,13 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
|
||||||
{getWebsiteStack("available-rooms", MainStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))}
|
{getWebsiteStack("available-rooms", MainStack, AvailableRoomScreen, i18n.t('screens.availableRooms'))}
|
||||||
{getWebsiteStack("bib", MainStack, BibScreen, i18n.t('screens.bib'))}
|
{getWebsiteStack("bib", MainStack, BibScreen, i18n.t('screens.bib'))}
|
||||||
{createScreenCollapsibleStack("self-menu", MainStack, SelfMenuScreen, i18n.t('screens.menuSelf'))}
|
{createScreenCollapsibleStack("self-menu", MainStack, SelfMenuScreen, i18n.t('screens.menuSelf'))}
|
||||||
|
<MainStack.Screen
|
||||||
|
name="map"
|
||||||
|
component={MapScreen}
|
||||||
|
options={{
|
||||||
|
title: "MAP", // TODO translate
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* STUDENTS */}
|
{/* STUDENTS */}
|
||||||
{createScreenCollapsibleStack("proximo", MainStack, ProximoMainScreen, i18n.t('screens.proximo'))}
|
{createScreenCollapsibleStack("proximo", MainStack, ProximoMainScreen, i18n.t('screens.proximo'))}
|
||||||
|
|
65
src/screens/Services/MapScreen.js
Normal file
65
src/screens/Services/MapScreen.js
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import {View} from 'react-native';
|
||||||
|
import {withTheme} from 'react-native-paper';
|
||||||
|
import {StackNavigationProp} from "@react-navigation/stack";
|
||||||
|
import type {CustomTheme} from "../../managers/ThemeManager";
|
||||||
|
import MapboxGL from "@react-native-mapbox-gl/maps";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
navigation: StackNavigationProp,
|
||||||
|
theme: CustomTheme,
|
||||||
|
}
|
||||||
|
|
||||||
|
MapboxGL.setAccessToken("sk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM212Z3QwYmxmMnhsc3RxZWYza2Q5In0.og84RKRa6-vr3qRA1qU9Aw");
|
||||||
|
|
||||||
|
const layerStyles = {
|
||||||
|
smileyFace: {
|
||||||
|
fillAntialias: true,
|
||||||
|
fillColor: 'white',
|
||||||
|
fillOutlineColor: 'rgba(255, 255, 255, 0.84)',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class defining the app's map screen.
|
||||||
|
*/
|
||||||
|
class MapScreen extends React.Component<Props> {
|
||||||
|
|
||||||
|
map : { current: null | MapboxGL.MapView };
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.map = React.createRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
MapboxGL.setTelemetryEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<View style={{flex: 1}}>
|
||||||
|
<MapboxGL.MapView
|
||||||
|
style={{flex: 1}}
|
||||||
|
styleURL={MapboxGL.StyleURL.Outdoors}
|
||||||
|
ref={this.map}
|
||||||
|
surfaceView={true}
|
||||||
|
onPress={async () => {
|
||||||
|
const center = await this.map.current.getCenter();
|
||||||
|
console.log(center);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MapboxGL.Camera
|
||||||
|
zoomLevel={15}
|
||||||
|
centerCoordinate={[1.4669608, 43.5698867]}
|
||||||
|
/>
|
||||||
|
</MapboxGL.MapView>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withTheme(MapScreen);
|
|
@ -49,6 +49,8 @@ type State = {
|
||||||
isLoggedIn: boolean,
|
isLoggedIn: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO translate subtitles
|
||||||
|
|
||||||
class ServicesScreen extends React.Component<Props, State> {
|
class ServicesScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
amicaleDataset: cardList;
|
amicaleDataset: cardList;
|
||||||
|
@ -119,6 +121,12 @@ class ServicesScreen extends React.Component<Props, State> {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
this.insaDataset = [
|
this.insaDataset = [
|
||||||
|
{
|
||||||
|
title: "MAP", // TODO translate
|
||||||
|
subtitle: "MAP",
|
||||||
|
image: RU_IMAGE,
|
||||||
|
onPress: () => nav.navigate("map"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t('screens.menuSelf'),
|
title: i18n.t('screens.menuSelf'),
|
||||||
subtitle: "the ru",
|
subtitle: "the ru",
|
||||||
|
|
Loading…
Reference in a new issue