feat(v10, ios) Custom compass image#2352
Conversation
|
@mfazekas Android actually has a lot of problems with ornaments - see the video below. Do you want me to have a go at fixing these, or do you think I should make this PR exclusively about the iOS compass image? android-compass.mov |
mfazekas
left a comment
There was a problem hiding this comment.
Thanks, much, looks great!
This is iOS only right?
Do you plan to implement it on android as well?
I'd prefer fixing in a separate issue, but if it's more convenient it can be fixed here as well. |
|
@naftalibeder @mfazekas The weird scale bar issue on Android is tied to a map view dimensions race condition. When the scale bar width is calculated on native I don't believe it has the final map view width and I didn't have enough time to look into how we could pass down the final value after the map is laid out. Test case: Rotate the app so the map layout is recalculated for landscape mode and notice the scale bar looks correct, then rotate back. |
|
@mfazekas Using the compass image property produces some challenges - for instance, sizing the compass, adding shadow that doesn't rotate, not to mention any animation is impossible. This is something you could easily do in a native app, but the React Native bridge bottleneck makes it unworkable. I did a quick proof of concept that shows how we could provide a Screen.Recording.2022-11-02.at.4.08.45.PM.movUsage would be something like: How would you feel about that? |
Looks acceptable for me. What about just providing a callback for rotation changes, so users can display animate the way they prefer? |
Maybe I'm misunderstanding, but if you're talking about a JavaScript callback, the issue is that sending that many events over the bridge that quickly is very inefficient and causes a lot of lag. Since a component like this only needs to rotate according to the camera bearing, all the rotation animation logic can exist on the native side, while allowing React Native to handle the view. (And there already is a callback for getting the current bearing, |
|
@mfazekas are you open to considering this an iOS-only feature and merging it? I can't even get the compass to show up on Android :/ - I plan on looking into it in the future but I can't right now. Then I would open the idea for a |
Sure that's fine, just add that the docs that it's iOS v10 only. |
|
@mfazekas good to go - ok? |
This reverts commit bb042ce.
This enables a custom image to be displayed in place of the default compass.
compass.mov