Skip to content

Repro: outlineColor crashes on Android (New Architecture) [#57190]#57451

Closed
slvvn wants to merge 1 commit into
react:mainfrom
slvvn:repro/57190-outline-color-crash
Closed

Repro: outlineColor crashes on Android (New Architecture) [#57190]#57451
slvvn wants to merge 1 commit into
react:mainfrom
slvvn:repro/57190-outline-color-crash

Conversation

@slvvn

@slvvn slvvn commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Reproduction for #57190.

On Android + New Architecture, setting outlineColor on any view crashes on mount:

java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
    at com.facebook.react.uimanager.BaseViewManagerDelegate.setProperty(BaseViewManagerDelegate.kt:107)

Root cause: in BaseViewManagerDelegate.kt, the outline color prop is cast directly to Int:

ViewProps.OUTLINE_COLOR -> mViewManager.setOutlineColor(view, value as Int?)

while the sibling color props go through ColorPropConverter.getColor(...):

ViewProps.BACKGROUND_COLOR -> setBackgroundColor(view, ColorPropConverter.getColor(value, view.context, 0))
ViewProps.SHADOW_COLOR     -> setShadowColor(view, ColorPropConverter.getColor(value, view.context, 0))

Under Fabric, color props are delivered as java.lang.Double, so value as Int? throws. Likely introduced in #46934; reproduces on 0.85+.

This PR edits RNTesterPlayground.js to reproduce the crash, per the contributing guidelines.

Changelog:

[INTERNAL] [CHANGED] - Repro for outlineColor ClassCastException in RNTesterPlayground

Test Plan

  1. Build RNTester for Android with the New Architecture enabled.
  2. Open the Playground example.
  3. The app crashes on mount with java.lang.Double cannot be cast to java.lang.Integer from BaseViewManagerDelegate.setProperty.

Not reproducible on iOS, and not on the legacy architecture when the packed ARGB color fits in a signed 32-bit int.

… Arch

RNTesterPlayground renders a View with outlineColor set, which crashes on
mount on Android + New Architecture with:
  java.lang.Double cannot be cast to java.lang.Integer
    at com.facebook.react.uimanager.BaseViewManagerDelegate.setProperty

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@meta-cla

meta-cla Bot commented Jul 7, 2026

Copy link
Copy Markdown

Hi @slvvn!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@slvvn

slvvn commented Jul 7, 2026

Copy link
Copy Markdown
Author

Closing — my repro does not actually reproduce the crash.

Running it locally in RNTester on main (Android + Fabric), the outlined view rendered fine. Root cause of the false negative:

  • outlineColor maps to colorAttribute in ReactNativeStyleAttributes.js, and with enableNativeCSSParsing at its default (false), a string colour is passed through processColor.
  • On Android, processColor does normalizedColor = normalizedColor | 0x0, which coerces the packed ARGB into a signed int32 — so the value crosses the JNI boundary as java.lang.Integer, and value as Int? in BaseViewManagerDelegate succeeds.

The bug still exists (the line is unchanged from v0.86.0 through main), but a static outlineColor cannot trigger it. The real trigger is any code path that writes the colour to the native prop bypassing processColor — most commonly Reanimated's updateProps writing an interpolated colour as a raw Double.

I'll open a fresh issue comment on #57190 with a runnable Reanimated-based repro and a proposed one-line fix (route OUTLINE_COLOR through ColorPropConverter.getColor like every sibling colour prop does).

@slvvn slvvn closed this Jul 7, 2026
@slvvn slvvn deleted the repro/57190-outline-color-crash branch July 7, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant