Skip to content

Crash on Android 14 (S24 Ultra) when setting edges prop on RNCSafeAreaView #475

@carloslibardo

Description

@carloslibardo

Description

I've encountered a crash in my React Native application on Android when trying to set the edges prop on RNCSafeAreaView. The application crashes with the following exception:

Exception com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'edges' of a view managed by: RNCSafeAreaView
...
Caused by java.lang.ClassCastException: com.facebook.react.bridge.ReadableNativeMap cannot be cast to com.facebook.react.bridge.ReadableArray

This issue seems to be related to how the edges prop is handled in the native Android implementation of RNCSafeAreaView.

Steps to Reproduce

  1. Use SafeAreaView with the edges prop set to an array of strings, e.g., edges={['top', 'left', 'right']}.
  2. Run the app on an Android device or emulator.

Expected Behavior

The SafeAreaView should correctly apply the safe area insets according to the specified edges without causing a crash.

Actual Behavior

The application crashes on Android with a JSApplicationIllegalArgumentException related to the edges prop.

Environment

  • React Native version: 0.73.4
  • React Native Safe Area Context version: 4.9.0
  • Device: S24 Ultra (I cannot reproduce in my device - S23 Ultra)

Code Snippet

Here are the snippets from my code where I use SafeAreaView:

<SafeAreaView
  edges={['top', 'left', 'right']}
  style={{ flex: 1 }}
>
...

Additional Context

I've followed the documentation for react-native-safe-area-context and the usage of SafeAreaView seems to be correct according to the examples provided. This crash is blocking further development and testing on Android devices.

Any assistance or guidance on how to resolve this issue would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions