No Description

MapView.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //@flow
  2. import React, { useState, useCallback } from 'react';
  3. import { SafeAreaView, Image } from 'react-native';
  4. import ViewShot from 'react-native-view-shot';
  5. import MapView from 'react-native-maps';
  6. import Desc from './Desc';
  7. const dimension = { width: 300, height: 300 };
  8. const MapViewExample = () => {
  9. const [source, setSource] = useState(null);
  10. const onCapture = useCallback(uri => setSource({ uri }), []);
  11. return (
  12. <SafeAreaView>
  13. <ViewShot onCapture={onCapture} captureMode="continuous" style={dimension}>
  14. <MapView
  15. initialRegion={{
  16. latitude: 37.78825,
  17. longitude: -122.4324,
  18. latitudeDelta: 0.0922,
  19. longitudeDelta: 0.0421,
  20. }}
  21. style={dimension}
  22. />
  23. </ViewShot>
  24. <Desc desc="above is a map view and below is a continuous screenshot of it" />
  25. <Image fadeDuration={0} source={source} style={dimension} />
  26. </SafeAreaView>
  27. );
  28. };
  29. MapViewExample.navigationOptions = {
  30. title: 'react-native-maps',
  31. };
  32. export default MapViewExample;