Skip to content

Fix shadowColor and outline prop defaults in BaseViewManagerDelegate - #59423

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
shubh73:fix-base-view-manager-delegate-defaults
Oct 28, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
shubh73:fix-base-view-manager-delegate-defaults

Conversation

@shubh73

@shubh73 shubh73 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

BaseViewManagerDelegate resets three props to values that don't match the @ReactProp defaults in BaseViewManager when they're removed:

Prop BaseViewManager default BaseViewManagerDelegate
shadowColor Color.BLACK 0
outlineOffset 0f YogaConstants.UNDEFINED
outlineWidth 0f YogaConstants.UNDEFINED

This affects every component whose view manager uses a codegen delegate (e.g. Switch, Modal, RefreshControl, and third-party Fabric components), but not View. Removing shadowColor from a view with elevation makes the shadow disappear instead of going back to black, and removing outlineOffset makes the outline disappear instead of drawing it with no offset.

This makes the delegate use the same defaults as BaseViewManager.

Changelog:

[ANDROID] [FIXED] - Fix shadowColor, outlineOffset and outlineWidth not resetting to their defaults on components with a codegen view manager delegate

Test Plan:

Added setShadowColorResetsToBlack, setOutlineOffsetResetsToZero and setOutlineWidthResetsToZero to BaseViewManagerDelegateTest. They pass with this change and fail without it (0 instead of -16777216, NaNf instead of 0.0f).

./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests "com.facebook.react.uimanager.BaseViewManagerDelegateTest"

Also checked in RNTester on an OPPO K12x 5G (CPH2667, Android 16) with a View and a Switch side by side, each with elevation + shadowColor: 'red' and outlineWidth + outlineOffset: 8, then removing shadowColor and outlineOffset:

  • Before: View resets correctly; on Switch the shadow and the outline both disappear.
  • After: Switch matches View (black shadow, outline with no offset).
Before After
Before After

🤖 Generated with Claude Code

BaseViewManagerDelegate reset shadowColor to 0 and outlineOffset and
outlineWidth to YogaConstants.UNDEFINED when the props were removed,
instead of the @ReactProp defaults in BaseViewManager (Color.BLACK and
0f). On components with a codegen delegate, removing shadowColor hid the
elevation shadow and removing outlineOffset hid the outline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

Visual regression

1 visual difference(s) at ea918849cbbf. Visual differences need maintainer approval. Review the report, then apply visual-change-approved.

ios: no capture

android transform/string/default: Changed, 1 px (0.000%)

diff

Expected and Captured
Expected Captured
expected captured

@meta-codesync

meta-codesync Bot commented Oct 27, 2026

Copy link
Copy Markdown

@javache has imported this pull request. If you are a Meta employee, you can view this in D127789219.

@meta-codesync
meta-codesync Bot merged commit dfed2d9 into react:main Oct 28, 2026
69 of 71 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @shubh73 in dfed2d9

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants