Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MapScreen.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // @flow
  2. import * as React from 'react';
  3. import {View} from 'react-native';
  4. import {withTheme} from 'react-native-paper';
  5. import {StackNavigationProp} from "@react-navigation/stack";
  6. import type {CustomTheme} from "../../managers/ThemeManager";
  7. import MapboxGL from "@react-native-mapbox-gl/maps";
  8. type Props = {
  9. navigation: StackNavigationProp,
  10. theme: CustomTheme,
  11. }
  12. type State = {
  13. featureCollection: Array<Object>,
  14. }
  15. MapboxGL.setAccessToken("pk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM2d5OHYwYmdiMndxdnV4bmh6bGFwIn0.qiOwbs2_HRaQGUOpBDjbsQ");
  16. // const styles = {
  17. // icon: {
  18. // iconImage: exampleIcon,
  19. // iconAllowOverlap: true,
  20. // },
  21. // };
  22. // const FEATURES = [{
  23. // type: 'Feature',
  24. // geometry: {
  25. // type: 'Point',
  26. // coordinates: [1.4669608, 43.5698867],
  27. // }
  28. // }]
  29. /**
  30. * Class defining the app's map screen.
  31. */
  32. class MapScreen extends React.Component<Props, State> {
  33. map: { current: null | MapboxGL.MapView };
  34. constructor() {
  35. super();
  36. this.map = React.createRef();
  37. this.state = {
  38. featureCollection: [],
  39. };
  40. }
  41. componentDidMount() {
  42. MapboxGL.setTelemetryEnabled(false);
  43. }
  44. // onSymbolPress = (feature) => {
  45. // console.log("coucou");
  46. // }
  47. //
  48. //
  49. // onSourceLayerPress = ({features, coordinates, point}) => {
  50. // console.log(
  51. // 'You pressed a layer here are your features:',
  52. // features,
  53. // coordinates,
  54. // point,
  55. // );
  56. // }
  57. render() {
  58. return (
  59. <View style={{flex: 1}}>
  60. <MapboxGL.MapView
  61. style={{flex: 1}}
  62. ref={this.map}
  63. styleURL={MapboxGL.StyleURL.Outdoors}
  64. surfaceView={true}
  65. onPress={(e) => {
  66. console.log(e)
  67. }}
  68. >
  69. <MapboxGL.Camera
  70. zoomLevel={15}
  71. centerCoordinate={[1.4669608, 43.5698867]}
  72. pitch={30}
  73. />
  74. {/*<MapboxGL.ShapeSource*/}
  75. {/* id="symbolLocationSource"*/}
  76. {/* shape={{ type: 'FeatureCollection', features: FEATURES }}*/}
  77. {/*>*/}
  78. {/* <MapboxGL.SymbolLayer*/}
  79. {/* id="symbolLocationSymbols"*/}
  80. {/* minZoomLevel={15}*/}
  81. {/* style={styles.icon}*/}
  82. {/* />*/}
  83. {/*</MapboxGL.ShapeSource>*/}
  84. </MapboxGL.MapView>
  85. </View>
  86. );
  87. }
  88. }
  89. export default withTheme(MapScreen);