getMapBoundaries method is not defined
psadeghian opened this issue ยท 18 comments
I am trying to use the getMapBoundaries method in my code, but the method is not defined.
Please note, I am for example able to use the animateToRegion method.
handleRegionChange = region => {
//I get an error for the statement below
console.log(this.map.getMapBoundaries())
};
//my MapView component
<MapView
style={styles.mapView}
ref={ref => {
this.map = ref;
}}
onRegionChangeComplete={this.handleRegionChange}
provider={MapView.PROVIDER_GOOGLE}
showsUserLocation={true}
showsCompass={true}
showsScale={true}
onMapReady={this.handleMapReady}
>
</MapView>
The version that has this method is not published yet on npm, use the git version.
Thank you for the response, the method now rejects due to the following reason:
undefined is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries')
Should I open a new issue?
getMapBoundaries
is async, I use it like this:
onRegionChangeComplete = async region => {
appStore.mapBoundaries = await this.map.getMapBoundaries();
...
also v0.23.0
was just published on npm so maybe you can try to update.
I did recognize the update, thank you!
I get the following error, could this be because I am using Expo?
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries')]
- node_modules/react-native-maps/lib/components/MapView.js:668:46 in getMapBoundaries$
- node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:296:30 in invoke
- node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:152:28 in invoke
- node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
- node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
- node_modules/regenerator-runtime/runtime.js:241:8 in async
* null:null in getMapBoundaries
@psadeghian yes, expo uses another version I think, you will need to wait for them to update or find a way to update it yourself
@rborn I am importing MapView from react-native-maps (I am not using the MapView provided by expo). I also tried using the git version.
@rborn I am having the same error: undefined is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries') I am using expo but have pulled v23 from github. What am I missing?
@psadeghian Did you figure this out?
Thanks,
Michael
@MichaelBalazs I am having the same error too. getMapBoundaries method seems to be not working on Android :(
Any updates here?
using version "~0.25.0",
Android has issues:
[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries')]
I've created a repo to reproduce the error - https://github.com/iampeterbanjo/react-native-maps-issues-2665
I'm also having this issue, is there a solution for it yet?
thanks!
I use a manual solution to get boundaries for now.
#356 (comment)
I seem to be encountering this issue on Android but not iOS, currently running expo sdk35 with react native maps 0.25
The root cause of this issue is with Expo sdk v35 and not react-native-maps. Using the same versions of react-native (0.59.10) and react-native-maps (0.25.0) as Expo (35), I can get map.getMapBoundaries
to work without Expo which means something Expo is doing is causing the issue. See https://github.com/iampeterbanjo/react-native-v59-maps for an example of a working demo.
I have opened an issue at Expo
@bkdev98 thank you for your workaround - it works but then I tried to use map.getCamera
and that failed too for the same reason. :'-(
Same here. I need several methods of this MapView :'(
Hi,
having same issue. Do you have any information when this will be fixed, as this criitcal issue, due to which it this impossible to use Maps on Android.
SDK 36