expo: react-native-maps method map.getMapBoundaries does not work

๐Ÿ› Bug Report

The method map.getMapBoundaries does exist but the module required by Android, AirMapModule, is null therefore an error is thrown:

[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries')]

This issue has been reported at react-native-maps but itโ€™s actually an issue with Expo. I have created a repo that demonstrates using the same dependencies as Expo, react-native (0.59.10) and react-native-maps (0.25.0) the map.getMapBoundaries method works. See https://github.com/iampeterbanjo/react-native-v59-maps.

Environment

Expo CLI 3.3.0 environment info: System: OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver) Shell: 4.4.19 - /bin/bash Binaries: Node: 8.11.4 - ~/.config/fnm/bin/node Yarn: 1.19.1 - /usr/bin/yarn npm: 6.9.0 - ~/.config/fnm/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman npmGlobalPackages: expo-cli: 3.3.0

We are using Expo and targeting iOS and Android. This issue occurs only on Android.

Steps to Reproduce

Expected Behavior

There should be no errors and the map should display on Android. See https://github.com/iampeterbanjo/react-native-v59-maps.

Actual Behavior

There is an error thrown:

[Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNative.NativeModules.AirMapModule.getMapBoundaries')]

Reproducible Demo

https://github.com/iampeterbanjo/react-native-maps-issues-2665

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Anything that relies on NativeModules.AirMapModule fails as it is undefined

Seems like itโ€™s still unfixed as of SDK 36

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

Same here too. Does anyone have a workaround or something ? This is a pretty annoying bug.

Same here SDK 35 react-native-maps 0.25

Any updates on this one?

We are also hitting this issue. Both on Expo 34 and 35 with native maps 0.24 or 0.25. Any updates on ways to work around this or when it might be fixed? Would hate to eject out of expo just for this issue.

I found how, not to getMapBoundaries, but calculate:

import { LatLng, Region } from 'react-native-maps'

export const getMapBoundaries = (region: Region): [LatLng, LatLng] => {
  const northEast = {
    latitude: region.latitude + region.latitudeDelta / 2,
    longitude: region.longitude + region.longitudeDelta / 2
  }
  const southWest = {
    latitude: region.latitude - region.latitudeDelta / 2,
    longitude: region.longitude - region.longitudeDelta / 2
  }

  return [northEast, southWest]
}

It appears that the AirMapModule is not linked through the Expo managed client via the expo install react-native-maps command, weโ€™ll need a fix for this. @brentvatne do you know if this was something addressed in upgrading any packages for the v36 upgrade thatโ€™s around the corner?