fix: Android Fabric marker content view not measured/laid out#63
Open
fix: Android Fabric marker content view not measured/laid out#63
Conversation
…ayout Agent-Logs-Url: https://github.com/dacoto/maps/sessions/bf453bb6-bc43-4f90-bd8f-49ade6ac8526 Co-authored-by: dacoto <16915053+dacoto@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes Android (React Native New Architecture/Fabric) custom marker views that weren’t being measured/la[id] out because the marker’s contentView was never attached to the native view hierarchy.
Changes:
- Add
ensureContentViewAttached()to lazily attachcontentViewto the view hierarchy. - Offset the attached
contentViewoff-screen via a large negativetranslationX. - Invoke
ensureContentViewAttached()when adding non-callout children.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Closes #61 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes custom marker views rendering incorrectly or not at all when using React Native's New Architecture (Fabric) on Android. In Fabric,
contentViewwas never attached to the view hierarchy, so Fabric skipped measure/layout passes on it and its children entirely.The fix lazily attaches
contentViewto the real view hierarchy viasuper.addView()on the first non-callout child addition. To avoid visually rendering it in the wrong position,translationXis set to-10000f(off-screen); this does not affectcreateContentBitmap(), which draws in the view's own coordinate space.Type of Change
Test Plan
contentViewis not visually rendered at an unexpected position on screen.Screenshots / Videos
Checklist