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

Fix custom marker updates on android #1611 #2048 #2320

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

fqborges
Copy link
Contributor

Does any other open PR do the same thing?

No

What issue is this PR fixing?

On Android, using Google Maps, markers with custom views/images are not being updated correctly when other properties are changed (mainly coordinates). Sometimes markers are not draw anymore, until the child view/image is changed.

#1611 and #2048 are related.

How did you test this PR?

  1. Create a simple app with a MapView and 3 or more markers that have distinct views for normal/selected states with distinct sizes.
  2. After MapView first rendered, dispatch changes to the markers coordinates and selected state (use a timer, button or marker touch event).
  3. Expect markers to not update or disappear from map after a couple of changes.
  4. Apply this patch and markers update as expected.
  • Which platform/api: Android & Google
  • Did you test this on a real device, or in a simulator? Simulator and Real device

@RobertGlynWilliams
Copy link

Thanks!

I just tested this on my project, and it instantly fixed a lot of the performance problems I have been dealing with 👍👍

@rborn
Copy link
Collaborator

rborn commented Jun 12, 2018

LGTM @alvelig 🐽

@alvelig
Copy link
Contributor

alvelig commented Jun 12, 2018

@fqborges Wow! So the problem was just new MarkerOptions() that were empty in certain situations?

@alvelig alvelig merged commit 4a2b453 into react-native-maps:master Jun 12, 2018
@fqborges
Copy link
Contributor Author

fqborges commented Jun 12, 2018

@alvelig Actually not empty, just outdated. And there was a chance of the outdated referenced bitmaps getting collected and not being valid for drawing anymore.

I found that in certain updates the markers are removed then added to map again, instead of just get the properties updated. In this cases, the marker options used are the original created, with the initial values.

@alvelig
Copy link
Contributor

alvelig commented Jun 12, 2018

Great job. I'll test and maybe close even more issues. Thank you!

@fqborges fqborges deleted the fix-marker-updates branch June 19, 2018 18:51
dmitriismitnov added a commit to 91team/react-native-maps that referenced this pull request Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants