Compare commits

...

4 commits

Author SHA1 Message Date
09de59c178 Added map icon 2020-06-22 20:07:26 +02:00
f644964473 Updated translations 2020-06-22 20:06:34 +02:00
936f2a8e9e Use public token 2020-06-22 20:02:34 +02:00
1af4688329 Tried implementing basic map markers 2020-06-22 16:04:08 +02:00
5 changed files with 61 additions and 19 deletions

View file

@ -111,7 +111,7 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
name="map" name="map"
component={MapScreen} component={MapScreen}
options={{ options={{
title: "MAP", // TODO translate title: i18n.t('screens.map'),
}} }}
/> />

View file

@ -12,26 +12,41 @@ type Props = {
theme: CustomTheme, theme: CustomTheme,
} }
MapboxGL.setAccessToken("sk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM212Z3QwYmxmMnhsc3RxZWYza2Q5In0.og84RKRa6-vr3qRA1qU9Aw"); type State = {
featureCollection: Array<Object>,
}
const layerStyles = { MapboxGL.setAccessToken("pk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM2d5OHYwYmdiMndxdnV4bmh6bGFwIn0.qiOwbs2_HRaQGUOpBDjbsQ");
smileyFace: {
fillAntialias: true, // const styles = {
fillColor: 'white', // icon: {
fillOutlineColor: 'rgba(255, 255, 255, 0.84)', // iconImage: exampleIcon,
}, // iconAllowOverlap: true,
}; // },
// };
// const FEATURES = [{
// type: 'Feature',
// geometry: {
// type: 'Point',
// coordinates: [1.4669608, 43.5698867],
// }
// }]
/** /**
* Class defining the app's map screen. * Class defining the app's map screen.
*/ */
class MapScreen extends React.Component<Props> { class MapScreen extends React.Component<Props, State> {
map : { current: null | MapboxGL.MapView }; map: { current: null | MapboxGL.MapView };
constructor() { constructor() {
super(); super();
this.map = React.createRef(); this.map = React.createRef();
this.state = {
featureCollection: [],
};
} }
componentDidMount() { componentDidMount() {
@ -39,23 +54,47 @@ class MapScreen extends React.Component<Props> {
} }
// onSymbolPress = (feature) => {
// console.log("coucou");
// }
//
//
// onSourceLayerPress = ({features, coordinates, point}) => {
// console.log(
// 'You pressed a layer here are your features:',
// features,
// coordinates,
// point,
// );
// }
render() { render() {
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<MapboxGL.MapView <MapboxGL.MapView
style={{flex: 1}} style={{flex: 1}}
styleURL={MapboxGL.StyleURL.Outdoors}
ref={this.map} ref={this.map}
styleURL={MapboxGL.StyleURL.Outdoors}
surfaceView={true} surfaceView={true}
onPress={async () => { onPress={(e) => {
const center = await this.map.current.getCenter(); console.log(e)
console.log(center);
}} }}
> >
<MapboxGL.Camera <MapboxGL.Camera
zoomLevel={15} zoomLevel={15}
centerCoordinate={[1.4669608, 43.5698867]} centerCoordinate={[1.4669608, 43.5698867]}
pitch={30}
/> />
{/*<MapboxGL.ShapeSource*/}
{/* id="symbolLocationSource"*/}
{/* shape={{ type: 'FeatureCollection', features: FEATURES }}*/}
{/*>*/}
{/* <MapboxGL.SymbolLayer*/}
{/* id="symbolLocationSymbols"*/}
{/* minZoomLevel={15}*/}
{/* style={styles.icon}*/}
{/* />*/}
{/*</MapboxGL.ShapeSource>*/}
</MapboxGL.MapView> </MapboxGL.MapView>
</View> </View>
); );

View file

@ -31,6 +31,7 @@ const WIKETUD_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Wiketud
const EE_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/EEC.png"; const EE_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/EEC.png";
const TUTORINSA_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/TutorINSA.png"; const TUTORINSA_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/TutorINSA.png";
const MAP_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Map.png";
const BIB_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Bib.png"; const BIB_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Bib.png";
const RU_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/RU.png"; const RU_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/RU.png";
const ROOM_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Salles.png"; const ROOM_IMAGE = "https://etud.insa-toulouse.fr/~amicale_app/images/Salles.png";
@ -122,9 +123,9 @@ class ServicesScreen extends React.Component<Props, State> {
]; ];
this.insaDataset = [ this.insaDataset = [
{ {
title: "MAP", // TODO translate title: i18n.t('screens.map'),
subtitle: "MAP", subtitle: "MAP",
image: RU_IMAGE, image: MAP_IMAGE,
onPress: () => nav.navigate("map"), onPress: () => nav.navigate("map"),
}, },
{ {

View file

@ -25,7 +25,8 @@
"profile": "Profile", "profile": "Profile",
"vote": "Elections", "vote": "Elections",
"scanner": "Scanotron 3000", "scanner": "Scanotron 3000",
"feedback": "Feedback" "feedback": "Feedback",
"map": "Campus Map"
}, },
"intro": { "intro": {
"slideMain": { "slideMain": {

View file

@ -25,7 +25,8 @@
"profile": "Profil", "profile": "Profil",
"vote": "Élections", "vote": "Élections",
"scanner": "Scanotron 3000", "scanner": "Scanotron 3000",
"feedback": "Votre avis" "feedback": "Votre avis",
"map": "Carte du campus"
}, },
"intro": { "intro": {
"slideMain": { "slideMain": {