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
- New Architecture enabled, Android.
- 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 }}
/>
);
}
- 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)
Description
BaseViewManagerDelegate.kthandlesOUTLINE_COLORwith a directIntcast, but Fabric delivers color props asDouble(same as other color props). This throwsClassCastExceptionwhenoutlineColoris set.BACKGROUND_COLORandSHADOW_COLORin the same file already useColorPropConverter.getColor().OUTLINE_COLORdoes not.Possibly introduced in #46934
Steps to reproduce
ActivityIndicator):Expected behavior
outlineColoris applied without crashing.Actual behavior
Root cause
Environment
main)