Repository navigation
Conversation
|
@Kerumen thanks for the fix, and sorry it took so long to get to it. Could you merge the latest |
|
@mfazekas I've merged main on this branch. Let me know if you need anything else! |
|
@Kerumen thanks for the fix and for merging main so quickly. One request: could you structure it like iOS, where the puck is built first and val puck = if (images.isEmpty()) {
makeDefaultLocationPuck2D(mContext, androidRenderMode ?: RenderMode.NORMAL)
} else {
LocationPuck2D(
topImage = images[PuckImagePart.TOP],
bearingImage = images[PuckImagePart.BEARING],
shadowImage = images[PuckImagePart.SHADOW],
)
}
location2.locationPuck = scale?.let { puck.copy(scaleExpression = it.toJson()) } ?: puckBehavior should be identical to your version, so a quick re-check on device is enough. |
|
@Kerumen thanks, the fix is right. Could we structure it like iOS instead, where the puck is built first and val puck = if (images.isEmpty()) {
makeDefaultLocationPuck2D(mContext, androidRenderMode ?: RenderMode.NORMAL)
} else {
LocationPuck2D(
topImage = images[PuckImagePart.TOP],
bearingImage = images[PuckImagePart.BEARING],
shadowImage = images[PuckImagePart.SHADOW],
)
}
location2.locationPuck = scale?.let { puck.copy(scaleExpression = it.toJson()) } ?: puckThat keeps |
The default puck branch of _apply() never received scaleExpression, so scale was ignored on Android unless custom puck images were set. Build the puck first, then apply scale once through copy(), as RNMBXNativeUserLocation.swift does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9b3851c to
cc15c2d
Compare
|
@mfazekas Restructured as suggested: the puck is built first and scale is applied once via |
The bug
LocationPuck'sscaleprop is documented as supporting zoom expressions, and it works on iOS — but on Android it is silently ignored unless you also supply custom puck images.So an app using the stock puck (the common case) gets a user marker fixed at one screen size while every other element on the map scales with zoom. Zoomed out, the puck ends up dwarfing everything around it.
Why
RNMBXNativeUserLocation._apply()branches onimages.isEmpty():The custom-images branch passes
scaleExpression; the default branch never receives it.iOS has no such split —
RNMBXNativeUserLocation.swiftbuilds the configuration (defaulting it when no images are supplied) and then appliesscaleunconditionally afterwards:The fix
Thread an optional
scaleExpressionthroughmakeDefaultLocationPuck2D.LocationPuck2Dalready accepts it alongside drawables — the same shapeLocationComponentManageruses. The new parameter is defaulted andmakeDefaultLocationPuck2Dhas a single call site, so no other behaviour changes and the stock puck keeps its platform look.12 insertions, 3 deletions, one file.
Reproducer & verification
A
MapViewwith no puck images and a zoom-scaledscale:Verified on an Android device (not just an emulator) in a real app, against 10.3.1; the same code is unchanged on
mainat 10.3.5.Happy to add an example scene if you'd like one — it wasn't obvious where a puck-scale demo best fits alongside the existing user-location examples, so I left
/exampleuntouched rather than guess.