How to use the @react-native-mapbox-gl/maps.snapshotManager function in @react-native-mapbox-gl/maps

To help you get started, we’ve selected a few @react-native-mapbox-gl/maps examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github developmentseed / observe / app / screens / OfflineMaps / ViewOfflineAreaDetail.js View on Github external
async takeSnapshot (aoi) {
    const { imageHeight: height, width } = this.state
    // MapboxGL expects these as [[maxX, maxY], [minX, minY]]
    const bounds = [[aoi[2], aoi[3]], [aoi[0], aoi[1]]]
    try {
      const uri = await MapboxGL.snapshotManager.takeSnap({
        bounds,
        width,
        height,
        styleURL: osmStyleURL
      })

      this.setState({
        preview: uri
      })
    } catch (err) {
      console.log('failed to take snapshot:', err)
    }
  }