question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getVisibleBounds() method doen't work

See original GitHub issue

getVisibleBounds() method doen’t work in map box v10

class ....{
.....
onRegionDidChange(){
          const  bounds = await this.mapBoxRef.current.getVisibleBounds();
.....}

render{    
return( <Mapbox.MapView
                ref={this.mapBoxRef}
          { flex: 1 }]}
                
                onRegionDidChange={e => {
                  this.mapUpdate(e);
                }}>
                <Mapbox.Camera
                  ref={ref => (this.cameraBoxRef = ref)}
                  zoomLevel={10}
                  centerCoordinate={[
                    this.state.mapBoxInitial
                      ? this.state.mapBoxInitial[0]
                      : 46.620784,
                    this.state.mapBoxInitial
                      ? this.state.mapBoxInitial[1]
                      : 24.810133,
                  ]}
                />
     </Mapbox.MapView>)
}}

Versions (please complete the following information):

  • Platform: [ Android]
  • Platform OS: [ Android 9]
  • Dev OS: [e.g. OSX ]
  • @rnmapbox/maps Version [e.g. 10.5]
  • React Native Version [e.g. 66.4]

.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vadim312commented, Nov 1, 2022

It’s happening again now on android only https://github.com/rnmapbox/maps/issues/2317

1reaction
wen-kaicommented, Jul 12, 2022

as another workaround we’re using @mapbox/geo-viewport package to estimate bounding boxes based on center, zoom level, and map width/height.

https://github.com/mapbox/geo-viewport#boundsviewport-zoom-dimensions-tilesize

Read more comments on GitHub >

github_iconTop Results From Across the Web

zoom to fit markers doesn't work when map isn't visible
getBounds (called in getBoundsZoomLevel) returns the visible area of the map, so I'd assume you would have to zoom to fit on the...
Read more >
[Android] Get visible bounds · Issue #3863 · mapbox ... - GitHub
Guys, Is is possible to get visible bounds? I haven't find any suitable method. I know how to set it (setVisibleCoordinateBounds) but getter ......
Read more >
Solved: JavaScript get map visible area - Esri Community
I am looking for JavaScript API (js.arcgis.com/4.15) that enables to get the map visible area. Hence, the X,Y coordinates of the visible area...
Read more >
Button | Android Developers
android:bufferType, Determines the minimum type that getText() will return. ... This view is invisible, and it doesn't take any space for layout purposes....
Read more >
Debugging guide | Google Earth Engine
The following examples demonstrate errors from using a variable and method that don't exist: Error — this code doesn't work!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found