react-native-maps: Android Device Only - Error while updating property 'showsUserLocation' of a view managed by: AIRMap
Summary
Hello,
I’m encountering an issue while using the latest versions of react-native-maps and react-native. Below, you’ll find a screenshot of my android/build.gradle file for reference:
Despite my efforts, I haven’t been able to resolve this problem. I’ve explored various solutions in the issues section, but none of them seem to work for me.
I’ve attempted the following in my android/app/build.gradle file:
Adding implementation "com.google.android.gms:play-services-location:20.0.0"
or implementation "com.google.android.gms:play-services-location:21.0.1"
Additionally, I experimented with different playServicesVersion values in android/build.gradle, including:
playServicesVersion = "18.0.0"
playServicesVersion = "20.0.0"
playServicesVersion = "21.0.1"
Also attempted using the beta version of react-native-maps, and it worked but it caused issues with my existing map code and contained some bugs, such as lacking support for animated in .fitToCoordinates."
Reproducible sample code
<MapView
ref={ref}
provider={PROVIDER_GOOGLE}
style={{flex: 1}}
showsUserLocation={true} // show user's current location
showsMyLocationButton={true} // show button to center on user's location
initialRegion={{
latitude: 6.1897,
longitude: 102.1573,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
{...props.mapProps}
// region={{
// latitude: 6.155625340041729,
// latitudeDelta: 0.02002058218781322,
// longitude: 102.1837292611599,
// longitudeDelta: 0.012100785970673655,
// }}
customMapStyle={mapOptions.customMapStyle}>
{props.children}
</MapView>
Steps to reproduce
Just run ./gradlew clean and yarn react-native run-android
Expected result
It should be working fine on showsUserLocation={true}. But if showsUserLocation={false} is ok.
Actual result
React Native Maps Version
^1.7.1
What platforms are you seeing the problem on?
Android
React Native Version
0.72.4
What version of Expo are you using?
Not using Expo
Device(s)
SAMSUNG GALAXY S20 FE (ANDROID 13)
Additional information
Please assist me in resolving this issue; I am currently stuck at this point. Thanks!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 16
Commits related to this issue
- Patched react-native-maps to address bug with showsUserLocation Solution from https://github.com/react-native-maps/react-native-maps/issues/4842#issuecomment-1713357892. — committed to inaturalist/iNaturalistReactNative by kueda 3 years ago
- Patched react-native-maps to address bug with showsUserLocation Solution from https://github.com/react-native-maps/react-native-maps/issues/4842#issuecomment-1713357892. — committed to inaturalist/iNaturalistReactNative by kueda 3 years ago
Facing the same issue after upgrading react-native from
0.71.10to0.72.4.EDIT: Created a patch file with the
patch-packagenpm package.If you need to patch your package here are the steps:
node_modules/react-native-maps/android/build.gradleto
patch packageas a project dependency withpackage.jsonscript section:The map is functioning correctly after I made changes to the dependency in the
node_modules/react-native-maps/android/build.gradlefile as follows:But please assist me in discovering a better and proper solution instead of this.
Still relevant, working through this issue with a react-native app now
can be reproduced! still relevant and using RN v0.72.10
Now it working fine, maybe that was my mistake. I placed “postinstall”: “patch-package” in the wrong location. Thanks.