Skip to content

BaseViewManagerDelegate crashes on outlineColor (Double cannot be cast to Integer) #57190

@slvvn

Description

@slvvn

Description

BaseViewManagerDelegate.kt handles OUTLINE_COLOR with a direct Int cast, but Fabric delivers color props as Double (same as other color props). This throws ClassCastException when outlineColor is set.

BACKGROUND_COLOR and SHADOW_COLOR in the same file already use ColorPropConverter.getColor(). OUTLINE_COLOR does not.

Possibly introduced in #46934

Steps to reproduce

  1. New Architecture enabled, Android.
  2. Render a core component that uses a codegen delegate (e.g. ActivityIndicator):
import { ActivityIndicator } from 'react-native';

export default function App() {
  return (
    <ActivityIndicator
      style={{ outlineColor: '#007AFF', outlineWidth: 2 }}
    />
  );
}
  1. Launch on Android.

Expected behavior

outlineColor is applied without crashing.

Actual behavior

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

Root cause

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

// Same file, works correctly
ViewProps.BACKGROUND_COLOR ->
    mViewManager.setBackgroundColor(view, ColorPropConverter.getColor(value, view.context, 0))

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

Environment

  • React Native: 0.85 (still present on main)
  • Platform: Android
  • Architecture: New Architecture (Fabric)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackNeeds: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions