Implemented tracksViewChanges
for Android
#2477
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Does any other open PR do the same thing?
No
What issue is this PR fixing?
This is related to the following issues:
#1870 #2105 #2048 #2082
How did you test this PR?
In my own project, with a progressing pie animation inside the marker.
I've also made sure that tracking stops when the marker is removed from the map etc.
Some background and explanation
iOS has the
tracksViewChanges
property which causes re-renders of the markers all the time, and slows down performance of the map greatly.Still, it is very handy especially given the async nature of React.
As many times the first images cached is of a blank component, it is very useful to use
tracksViewChanges=true
and then set it tofalse
whencomponentDidUpdate
is hit.Another issue is loading images. Assuming the image loading issue will be fixed one day - we will still want
tracksViewChanges
and disabled that whenonLoadEnd
hits.We could even start with it as a false value, and then turn it on and off when the loading is done.
Now some people use several hacks for the image issue on Android, like actual changes to Fesco code and usage of SVG images inside the Marker. But in those cases it is still slightly unstable and sometimes blank - but just because of the asyncronisity of react. This will also solve that.
I've set a default fps of 25, which seemed reasonable to me. But based on user feedback this could be easily adjusted.