react-native-checkbox / react-native-checkbox

Checkbox component for React Native
MIT License
378 stars 89 forks source link

NullPointerException Crash in ReactCheckBoxManager on React Native 0.76.1 #226

Open AliRezaBeigy opened 1 week ago

AliRezaBeigy commented 1 week ago

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:

JaioSkura commented 1 week ago

Same here. Any solution???

AliRezaBeigy commented 1 week ago

@JaioSkura disable new arch can fix this issue Anyway we rollback to 0.75.4 there are some other issue in ios in new react native version, I suggest wait for more stable version

JaioSkura commented 1 week ago

Ok! Thanks!!!

mehedirana commented 3 days ago

The app crashes when attempting to use the checkbox component. Any solution???

Biplovkumar commented 1 day ago

Same here. Please reply!

AliRezaBeigy commented 1 day ago

This repo didn't support new architecture, you have to disable new arch to use it or use another lib for checkbox

JaioSkura commented 1 day ago

Thanks all! I finally decided to change library, cause rolling back RN version was not and option in my case.

boazpoolman commented 23 hours ago

@JaioSkura What alternative library did you end up choosing?

JaioSkura commented 23 hours ago

I used the checkbox from 'react-native-elements', tha change was really easy and worked like charm. The main reason for choosing that library was that I was alreading using it for other components.