Skip to content

NullPointerException Crash in ReactCheckBoxManager on React Native 0.76.1 #226

@AliRezaBeigy

Description

@AliRezaBeigy

Description:

We encountered a NullPointerException crash when attempting to interact with the checkbox component in our React Native app. This issue specifically occurs when the ReactCheckBoxManager tries to access the EventDispatcher from a null UIManagerModule reference. This crash has been observed on React Native version 0.76.1.

Stack Trace:

E  FATAL EXCEPTION: main
    Process: com.pokket.challenger.plus, PID: 9991
    java.lang.NullPointerException: Attempt to invoke virtual method 'com.facebook.react.uimanager.events.EventDispatcher com.facebook.react.uimanager.UIManagerModule.getEventDispatcher()' on a null object reference
    	at com.reactnativecommunity.checkbox.ReactCheckBoxManager$1.onCheckedChanged(ReactCheckBoxManager.java:37)
    	at com.reactnativecommunity.checkbox.ReactCheckBox.setChecked(ReactCheckBox.java:27)
    	at android.widget.CompoundButton.toggle(CompoundButton.java:137)
    	at android.widget.CompoundButton.performClick(CompoundButton.java:142)
    	at android.view.View.performClickInternal(View.java:7425)
    	at android.view.View.access$3600(View.java:810)
    	at android.view.View$PerformClick.run(View.java:28305)
    	at android.os.Handler.handleCallback(Handler.java:938)
    	at android.os.Handler.dispatchMessage(Handler.java:99)
    	at android.os.Looper.loop(Looper.java:223)
    	at android.app.ActivityThread.main(ActivityThread.java:7656)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Steps to Reproduce:

  1. Upgrade to React Native 0.76.1.
  2. Integrate the @react-native-community/checkbox package.
  3. Interact with the checkbox component.
  4. Observe the crash occurring on Android.

Expected Behavior:

The checkbox component should work without causing a crash.

Actual Behavior:

The app crashes when attempting to use the checkbox component due to a NullPointerException when accessing the EventDispatcher.

Environment:

  • React Native version: 0.76.1
  • react-native-checkbox: Latest version at the time of writing
  • Platform: Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions