Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Android AsyncDrawable’s placeholder path mutates drawable/state from a background thread (and doesn’t set placeholder bounds), which can cause incorrect rendering and thread-safety issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the iOS and Android implementations so inline image “broken/invalid” placeholders inherit the current text color, matching the intended behavior seen on web.
Changes:
- iOS: updates attachment image view tinting to follow the current configured primary/text color during attachment layout updates.
- Android: plumbs a “current text color” value through span factories and image span creation, and adds refresh logic to update existing placeholder tints when the text color changes.
- Android: adds placeholder-tint support to both async (network) image drawables and static fallback placeholder drawables.
File summaries
| File | Description |
|---|---|
| ios/utils/AttachmentLayoutUtils.mm | Updates attachment UIImageView tintColor to track the current configured color. |
| android/src/main/java/com/swmansion/enriched/textinput/styles/ParametrizedStyles.kt | Passes currentTextColor into image span creation for inline images. |
| android/src/main/java/com/swmansion/enriched/textinput/spans/EnrichedInputImageSpan.kt | Adds placeholder tint/color plumbing and static-placeholder tracking. |
| android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt | Refreshes existing image placeholder tints when the view color changes. |
| android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputSpannableFactory.kt | Tracks textColor for span creation and forwards it to image span creation. |
| android/src/main/java/com/swmansion/enriched/text/spans/EnrichedTextImageSpan.kt | Adds placeholder tint/color plumbing and static-placeholder tracking for non-input text. |
| android/src/main/java/com/swmansion/enriched/text/EnrichedTextView.kt | Refreshes existing image placeholder tints when the view color changes. |
| android/src/main/java/com/swmansion/enriched/text/EnrichedTextSpanFactory.kt | Tracks textColor for span creation and forwards it to image span creation. |
| android/src/main/java/com/swmansion/enriched/common/spans/EnrichedImageSpan.kt | Adds placeholder refresh API + passes tint color into AsyncDrawable creation. |
| android/src/main/java/com/swmansion/enriched/common/parser/EnrichedSpanFactory.kt | Extends the span-factory contract to carry a textColor value. |
| android/src/main/java/com/swmansion/enriched/common/AsyncDrawable.kt | Adds placeholder tinting support for async-loaded images. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| mainHandler.post { | ||
| loadPlaceholderImage() | ||
| } |
There was a problem hiding this comment.
This was caught by Copilot. Previously loadPlaceholderImage which mutates AsyncDrawable internal state, could be run from a secondary thread. This may lead to some state desynchronization, so we delegate it to the main thread, just like we already do few lines above
Summary
The inline image's placeholder colors were inconsistent across all platforms:
Test Plan
Create an inline image with an invalid url to create a img placeholder. Next adjust the
EnrichedTextInputstyleprop, with a changedcolor. Notice the updated color on the placeholder.Screenshots / Videos
Before(iOS):
After (iOS):
Compatibility
Checklist