Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom markers doesn't always update on android #2048

Closed
vvusts opened this issue Feb 28, 2018 · 10 comments
Closed

Custom markers doesn't always update on android #2048

vvusts opened this issue Feb 28, 2018 · 10 comments
Labels

Comments

@vvusts
Copy link

vvusts commented Feb 28, 2018

RN - 0.52
RN Maps - 0.20.1
IOS - work perfect
Android - is problem

I render a lot of markers and use clustering (react-native-maps-super-cluster) but this is related to map.
Markers use custom images like: marker.png and selectedMarker.png
I have list of buttons bellow map. When button is pressed it .animateToRegion() where some marker is.
Selecting button update state variable like selectedMarkerId.
In function that render marker I check this variable and based on that set different marker image.
Problem is that on android this image replace doesn't work. And then I move map so marker is not visible and back it again and then image is updated.
I tried with setting key to be Math.random() but this make marker flicker as I move map and change selections.
Does anybody have problem like this and is there solution?

@vuphuctho
Copy link

Same issue with you but in my case I don't call animateToRegion but update region by changing state. using Math.random() for updating key values work for me, no more flickering happens.

@vvusts
Copy link
Author

vvusts commented Mar 4, 2018

Where exactly you set math.random?
On marker key? On marker image?
I set id of location from database for marker key so for me that is not random. I set on custom image but then I get flickering.

@bramus
Copy link
Contributor

bramus commented Mar 4, 2018

Could it be that this is a duplicate of #1288 ?

@vvusts
Copy link
Author

vvusts commented Mar 4, 2018

No, markers are moving fine it’s image for marker that is not update.

For example: you have two markers in a view region and two buttons one should update image one one and second on another.
Click on button update once.
But when you click on second button marker image is not changed.
But if you move map so that marker is not visible and back agin it update marker image.
And this is only on android.

@bramus
Copy link
Contributor

bramus commented Mar 4, 2018

Ah, thanks for the clarification … I get it now :)

@vuphuctho
Copy link

@vvusts I updated marker key, based on this explanation.

fqborges added a commit to fqborges/react-native-maps-osmdroid that referenced this issue Jun 11, 2018
fqborges added a commit to fqborges/react-native-maps-osmdroid that referenced this issue Jun 11, 2018
alvelig added a commit that referenced this issue Jun 12, 2018
timxyz pushed a commit to 3sidedcube/react-native-maps that referenced this issue Aug 24, 2018
* master: (168 commits)
  Adding overlaying components details (react-native-maps#2425)
  docs: pin color limitations for android (react-native-maps#2429)
  Revert "Added MBTiles support for iOS and Android (react-native-maps#2208)" (react-native-maps#2387)
  Added MBTiles support for iOS and Android (react-native-maps#2208)
  Fix disabling the toolbar and my location button (react-native-maps#2317)
  Fixes warnings about self (react-native-maps#2341)
  Android: Fix lineCap of Polyline (react-native-maps#2375)
  Update installation.md (react-native-maps#2381)
  update doc (react-native-maps#2363)
  zIndex doesn't work when the map moves in iOS 11 (react-native-maps#2359)
  Fix readme formatting (react-native-maps#2358)
  add support for calloutAnchor with GoogleMaps on iOS; fixes react-native-maps#1852 (react-native-maps#2351)
  Added animateToNavigation method to MapView (react-native-maps#2049)
  Add react-native@^0.55 to peerDependencies (react-native-maps#2332)
  Fix custom marker updates on android react-native-maps#1611 react-native-maps#2048
  [iOS] Prefix or eliminate globals in AIRMapMarker (react-native-maps#2306)
  Fix CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF warnings (react-native-maps#2154)
  Fix for compile error (react-native-maps#2215). (react-native-maps#2232)
  Make tiles display at the same physical size regardless of pixel dens… (react-native-maps#2248)
  Added support of lineDashPattern polyline prop to iOS Google Maps (react-native-maps#2243)
  ...

# Conflicts:
#	lib/components/MapMarker.js
@Khsed4
Copy link

Khsed4 commented Aug 27, 2018

@vvusts I'm stuck the same issue , have u found the solution ? if yes kindly post it here

@khuongdv
Copy link

khuongdv commented Sep 6, 2018

@vuphuctho I tried that way but in real devices the issue still occurs @@

@abhideepmallick
Copy link

Working solution #2734 (comment)

@stale
Copy link

stale bot commented Oct 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 3, 2020
@stale stale bot closed this as completed Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants