react-native-map-clustering icon indicating copy to clipboard operation
react-native-map-clustering copied to clipboard

Not compatible with Expo SDK 52 on Android

Open BauerKristof opened this issue 11 months ago • 40 comments

The markers are unvisible if you're using the the new expo 52+ versions on Android

BauerKristof avatar Jan 03 '25 19:01 BauerKristof

You might have to disable the new architecture for React Native on Android.

You can do this by adding this flag for Android in your app.json file:

 "android": {
      "newArchEnabled": false,
    }

sttaseen avatar Jan 16 '25 23:01 sttaseen

Hello everyone, are there any updates on this? I have installed SDK 52 and the clustering no longer works at all. Only when I zoom in very close my markers are displayed but no clusters. Even if I zoom out, the markers are no longer displayed.

I use SDK 52

AaronH2001 avatar Mar 13 '25 15:03 AaronH2001

Hey there, having the same issue with expo, SDK 52. Even when I manage to display the clusters on android, through extensive code lines, they flicker. Any alternative?

mister97 avatar Apr 14 '25 04:04 mister97

The markers are unvisible if you're using the the new expo 52+ versions on Android

Hey @BauerKristof, is it happening only on Android, or on iOS as well?

mhmdiqbal avatar Apr 24 '25 22:04 mhmdiqbal

here are two patches to make the lib work on android and iOS on RN 0.78.

@tomekvenits I may be able to take over the maintenance of the library if you want.

react-native-map-clustering+3.4.2.patch react-native-maps+1.20.1.patch

HugoGresse avatar Apr 29 '25 15:04 HugoGresse

It would be nice, because the only alternative to this is the Supercluster lib, but i found it soooo complex that i give up and i will try to fix the map-clustering

rafx01 avatar Apr 30 '25 14:04 rafx01

@rafx01 you can use patch-package lib to apply both of my patches to make it work.

HugoGresse avatar Apr 30 '25 14:04 HugoGresse

@HugoGresse Yeah, i solved the problem by setting the newArchEnabled to false in the gradle.properties. But i was talking about you maintaining the lib, because this lib is so much simpler to work with

rafx01 avatar Apr 30 '25 14:04 rafx01

@rafx01 you can use patch-package lib to apply both of my patches to make it work.

Thank you for your patch, it works mostly under Expo 53 / Android (I'm still testing iOS). However, I have a small display error, the cluster is only 1/4 visible:

Image

Du you have an idea how to fix this?

iuvabo avatar May 05 '25 04:05 iuvabo

@rafx01 you can use patch-package lib to apply both of my patches to make it work.

Thank you for your patch, it works mostly under Expo 53 / Android (I'm still testing iOS). However, I have a small display error, the cluster is only 1/4 visible:

Image

Du you have an idea how to fix this?

Use the react-native-maps 1.20.1 patch to fix an issue with newArchitecture react-native-maps+1.20.1.patch See https://github.com/react-native-maps/react-native-maps/pull/5103

HugoGresse avatar May 05 '25 07:05 HugoGresse

@rafx01 you can use patch-package lib to apply both of my patches to make it work.

Thank you for your patch, it works mostly under Expo 53 / Android (I'm still testing iOS). However, I have a small display error, the cluster is only 1/4 visible: Image Du you have an idea how to fix this?

Use the react-native-maps 1.20.1 patch to fix an issue with newArchitecture react-native-maps+1.20.1.patch See react-native-maps/react-native-maps#5103

Thank you, I already applied both patches from your post above. I'm using a Custom Marker, which is also cut off (about 40x40px are shown, my Image is 30x44px). I will investigate and report.

Edit: Works great on development build. Not working in Expo Go, which makes sense. Thank you!

iuvabo avatar May 05 '25 07:05 iuvabo

@iuvabo check this issue : https://github.com/react-native-maps/react-native-maps/issues/5247 I'm having this error too, my custom markers are only showing 40x40px... still waiting for someone to solve this

rafx01 avatar May 05 '25 18:05 rafx01

@iuvabo check this issue : react-native-maps/react-native-maps#5247 I'm having this error too, my custom markers are only showing 40x40px... still waiting for someone to solve this

Tested it in development build and store version in Expo 53 - works great with the supplied patches, both iOS and Android.

iuvabo avatar May 05 '25 19:05 iuvabo

@HugoGresse Do you know why a patch is needed for react-native-maps 1.20.1? It works great with just the react-native-map-clusturing patch.

Sultron avatar May 05 '25 22:05 Sultron

@Sultron to fix the issue on android for the marker having different sizes, as demonstrated by https://github.com/tomekvenits/react-native-map-clustering/issues/279#issuecomment-2850121810 And PR here on maps : https://github.com/react-native-maps/react-native-maps/pull/5103

HugoGresse avatar May 05 '25 23:05 HugoGresse

@HugoGresse Could you please tell us how to use the patch? Thanks

STASIA-Digital avatar May 06 '25 21:05 STASIA-Digital

@STASIA-Digital using patch-package https://www.npmjs.com/package/patch-package

HugoGresse avatar May 09 '25 12:05 HugoGresse

@HugoGresse Thanks :) I can confirm that the patch works and the marker is shown completely and not cutted.

For more details on the steps:

  1. Add the patch file to a folder named patches Image
  2. You need to install patch-package https://www.npmjs.com/package/patch-package like Hugo said
  3. You can add "postinstall": "patch-package" to your scripts in the package.json for manual install. Note that during each npm install, the patch will be installed automatically

STASIA-Digital avatar May 11 '25 19:05 STASIA-Digital

I have downloaded the patch, put it in it's own folder called patches, downloaded the npm i patch-package and nothing seems to work. i've tried many alternatives too but my map marker keeps getting cut off on android. I'm running on Expo 53, does anybody have a fix? @HugoGresse

davitarakelian avatar May 25 '25 02:05 davitarakelian

I have downloaded the patch, put it in it's own folder called patches, downloaded the npm i patch-package and nothing seems to work. i've tried many alternatives too but my map marker keeps getting cut off on android. I'm running on Expo 53, does anybody have a fix? @HugoGresse

did you download both patches? did you update the postinstall script?

scripts: { 
        "postinstall": "patch-package",
} 

and runned npm i?

HugoGresse avatar May 26 '25 07:05 HugoGresse

I have downloaded the patch, put it in it's own folder called patches, downloaded the npm i patch-package and nothing seems to work. i've tried many alternatives too but my map marker keeps getting cut off on android. I'm running on Expo 53, does anybody have a fix? @HugoGresse

did you download both patches? did you update the postinstall script?

scripts: { 
        "postinstall": "patch-package",
} 

and runned npm i?

I have yes, I get an error

Error: Patch file found for package react-native-map-clustering which is not present at node_modules/react-native-map-clustering

patch-package finished with 1 error

davitarakelian avatar May 26 '25 19:05 davitarakelian

I have downloaded the patch, put it in it's own folder called patches, downloaded the npm i patch-package and nothing seems to work. i've tried many alternatives too but my map marker keeps getting cut off on android. I'm running on Expo 53, does anybody have a fix? @HugoGresse

did you download both patches? did you update the postinstall script?

scripts: { 
        "postinstall": "patch-package",
} 

and runned npm i?

I have yes, I get an error

Error: Patch file found for package react-native-map-clustering which is not present at node_modules/react-native-map-clustering

patch-package finished with 1 error

maybe read the error? It is written in plain letters. Another solution would be to get the help from some AI, like Claude or ChatGPT...

HugoGresse avatar May 26 '25 19:05 HugoGresse

I have downloaded the patch, put it in it's own folder called patches, downloaded the npm i patch-package and nothing seems to work. i've tried many alternatives too but my map marker keeps getting cut off on android. I'm running on Expo 53, does anybody have a fix? @HugoGresse

did you download both patches? did you update the postinstall script?

scripts: { 
        "postinstall": "patch-package",
} 

and runned npm i?

I have yes, I get an error

Error: Patch file found for package react-native-map-clustering which is not present at node_modules/react-native-map-clustering

patch-package finished with 1 error

maybe read the error? It is written in plain letters. Another solution would be to get the help from some AI, like Claude or ChatGPT...

You are right the error is clear lol. I've been going crazy trying to find a fix for the markers getting cut off. ChatGPT doesn't seem to be any help what so ever.

Now, even after putting the patch file into the folder, my map markers are still being cut off. On my emulator, Pixel 7 API 34 the map markers look fine but, on my physical android device which is a A13 API 36 the map markers are being cut off still. My A13 is android 13 and the emulator is 14

davitarakelian avatar May 26 '25 19:05 davitarakelian

Do you want a support invoice? >< The code of the map-clustering is open source, which allow you to digg into the problem fairly easily.

HugoGresse avatar May 27 '25 07:05 HugoGresse

https://www.npmjs.com/package/@allisonadam81/react-native-super-clusters

I forked this, and it's working for my app out of the box on RN .79.2, React 19, latest react native maps, etc. Feel free to use. I'll be updating it over the next few weeks. Just needed to get something working and published today because I like the API for the app I'm working on.

allisonadam81 avatar May 29 '25 21:05 allisonadam81

I am using RN 79.1. In my app after adding patches .. clusters are visible in Ios devices but clusters are not visible in Android device.. tough they are there are if i click of any cluster position markers are showing after zooming in.. but clusters are not showing in map.

Edit: After adding tracksViewChanges: true in MapView component.. Clusters are visible in android also but they are getting cropped in android.. however in Ios it is visible correctly.. see the image below.. how it is looking in android.

Image

vksdgreat avatar Jul 24 '25 10:07 vksdgreat

I am using RN 79.1. In my app after adding patches .. clusters are visible in Ios devices but clusters are not visible in Android device.. tough they are there are if i click of any cluster position markers are showing after zooming in.. but clusters are not showing in map.

Edit: After adding tracksViewChanges: true in MapView component.. Clusters are visible in android also but they are getting cropped in android.. however in Ios it is visible correctly.. see the image below.. how it is looking in android.

Image

Apply the patch mentioned above. Note that it only displays correctly when using a development build or APK.

jonacds avatar Jul 24 '25 17:07 jonacds

The newest version (4.0.0) two days ago seems to have the same problem in Expo 53

ynshung avatar Jul 26 '25 04:07 ynshung

Can confirm, having the same issue with v4.0.0 and cut off clusters when applying the patch (modified for v4.0.0).

Setting tracksViewChanges={Platform.OS === "android"} on the ClusteringMapView solved the issue for me, but it's not ideal. The clusters are flickering every few seconds and there's probably some performance / battery usage impact.

ptreitler avatar Aug 05 '25 13:08 ptreitler

I've scheduled to test the v4 next week, I'll let you know.

HugoGresse avatar Aug 05 '25 13:08 HugoGresse