Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
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 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. MapboxGL.setAccessToken("sk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM212Z3QwYmxmMnhsc3RxZWYza2Q5In0.og84RKRa6-vr3qRA1qU9Aw");
  13. const layerStyles = {
  14. smileyFace: {
  15. fillAntialias: true,
  16. fillColor: 'white',
  17. fillOutlineColor: 'rgba(255, 255, 255, 0.84)',
  18. },
  19. };
  20. /**
  21. * Class defining the app's map screen.
  22. */
  23. class MapScreen extends React.Component<Props> {
  24. map : { current: null | MapboxGL.MapView };
  25. constructor() {
  26. super();
  27. this.map = React.createRef();
  28. }
  29. componentDidMount() {
  30. MapboxGL.setTelemetryEnabled(false);
  31. }
  32. render() {
  33. return (
  34. <View style={{flex: 1}}>
  35. <MapboxGL.MapView
  36. style={{flex: 1}}
  37. styleURL={MapboxGL.StyleURL.Outdoors}
  38. ref={this.map}
  39. surfaceView={true}
  40. onPress={async () => {
  41. const center = await this.map.current.getCenter();
  42. console.log(center);
  43. }}
  44. >
  45. <MapboxGL.Camera
  46. zoomLevel={15}
  47. centerCoordinate={[1.4669608, 43.5698867]}
  48. />
  49. </MapboxGL.MapView>
  50. </View>
  51. );
  52. }
  53. }
  54. export default withTheme(MapScreen);