fix(android) transparent header backgroundColor dropped by Props 2.0 - #4524
Open
delekta wants to merge 1 commit into
Open
fix(android) transparent header backgroundColor dropped by Props 2.0#4524delekta wants to merge 1 commit into
delekta wants to merge 1 commit into
Conversation
t0maboro
self-requested a review
August 19, 2026 14:14
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.
Description
On Android Fabric with Props 2.0 (
enablePropsUpdateReconciliationAndroid),ScreenStackHeaderConfigbackgroundColor="transparent"never reaches native. JS still has the color (processColoris0). Native never callssetBackgroundColor, so the toolbar keeps MaterialcolorPrimary.iOS is unaffected (it does not use the
getDiffPropspath).Android
HostPlatformColor::UndefinedColoris0, and so isprocessColor('transparent')/'#00000000'/'rgba(0,0,0,0)'. WithoutgenerateOptionalProperties, codegen emitsSharedColor backgroundColor{}whose default is also0. On CREATE, Props 2.0 diffs against that default, omits the key, and Kotlin never paints.This is a CREATE-path bug. A red → transparent UPDATE diffs against the previous color and can hide it.
Minimal repro: https://github.com/delekta/screens-transparent-header-bug-repro
RN
0.87.0, screens4.27.0, screens-only (no React Navigation required).Do not disable Props 2.0 as the library fix.
Changes
generateOptionalProperties: trueonRNSScreenStackHeaderConfigso omitted isnulloptand transparent isoptional(0). The diff then emits0and nativesetBackgroundColor(0)runs.title.empty()→!title.has_value() || title->empty()inRNSScreenShadowNode.cppupdateProps: unwrapstd::optionalforRCTNSStringFromStringNilIfEmpty,RCTUIColorFromSharedColor, and header bar-button vectorsInt?already). Unset color still skips the setter (theme bar). Transparent now applies0.Please also cherry-pick onto
main(5.0 /src/fabric/legacy/…) if that spec is still used there.Before & after - visual documentation
Chip 2. transparent on the repro (CREATE / remount). Expected: lime page shows through the header. Fail: leftover Material bar.
transparent-header-before.mov
transparent-header-after.mov
Opaque red (chip 1) should stay red in both.
Test plan
Repro: https://github.com/delekta/screens-transparent-header-bug-repro
Keep
ENABLE_PROPS_2_0 = trueinMainApplication.kt. Each chip remounts the stack so 2–4 are CREATE.#00000000andrgba(0,0,0,0)same as transparent.#FFFFFF00still works (alpha 0, RGB ≠ 0).ENABLE_PROPS_2_0 = false, rebuild; chip 2 already correct without this PR.Same bug via native-stack: in the repro
index.jsimport./App.native-stackinstead of./App.No new example files in this repo; the repro app is the test.
Checklist