React-native-mapbox-gl: Any way to use maxBounds?

Created on 27 Dec 2017  路  4Comments  路  Source: nitaliano/react-native-mapbox-gl

Is there any way to use maxBounds to limit the map? It's available in mapbox-gl-js, but I couldn't find any information about it for react-native-mapbox-gl

Or is there any other way to limit map to a certain area?

Most helpful comment

This is something we can look into adding as a feature, there is no property in gl-native like in gl-js to restrict the bounds like this. What we can do in the native code is before we move the camera check the the bounds we are going to move to our valid like this example for iOS https://www.mapbox.com/ios-sdk/examples/constraining-gestures/ so the api will be similar to gl-js from the JS API of this repo and we polyfill the functionality on the native side

All 4 comments

Please check #498

@kaynz Thanks for the reply!

The solution provided in #498 doesn't really solve the issue, as a user is able to scroll as far as they want even with the minZoomLevel set.

Here is an example of what I'm trying to achieve https://www.mapbox.com/mapbox-gl-js/example/restrict-bounds/

Any ideas?

This is something we can look into adding as a feature, there is no property in gl-native like in gl-js to restrict the bounds like this. What we can do in the native code is before we move the camera check the the bounds we are going to move to our valid like this example for iOS https://www.mapbox.com/ios-sdk/examples/constraining-gestures/ so the api will be similar to gl-js from the JS API of this repo and we polyfill the functionality on the native side

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EugenePisotsky picture EugenePisotsky  路  4Comments

zeljkoX picture zeljkoX  路  4Comments

VentsislavDinev picture VentsislavDinev  路  3Comments

lernerbot picture lernerbot  路  3Comments

alexisohayon picture alexisohayon  路  4Comments