Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on react-native 0.76(new architecture) #589

Open
mbilenko-florio opened this issue Oct 25, 2024 · 1 comment
Open

Crash on react-native 0.76(new architecture) #589

mbilenko-florio opened this issue Oct 25, 2024 · 1 comment

Comments

@mbilenko-florio
Copy link

mbilenko-florio commented Oct 25, 2024

Library version: 2.9.0
React native version: 0.76.0, new architecture enabled

When opening react-native-picker, I get this error in runtime:

Process: app.florio.userfactor, PID: 29998
java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.bridge.ReadableNativeMap com.facebook.react.uimanager.StateWrapper.getStateData()' on a null object reference
at com.reactnativecommunity.picker.FabricEnabledPicker.updateState(FabricEnabledPicker.java:45)
at com.reactnativecommunity.picker.FabricEnabledPicker.setMeasuredHeight(FabricEnabledPicker.java:32)
at com.reactnativecommunity.picker.ReactPicker.onMeasure(ReactPicker.java:226)

This patch seems to fix it:

diff --git a/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java b/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
index 08edd095d688be68fba52be667fc416a0d290b3b..925fc2b296151ba9325a3d9cd5fbd57454c232d5 100644
--- a/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
+++ b/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
@@ -35,6 +35,11 @@ public abstract class FabricEnabledPicker extends AppCompatSpinner {
     void updateState(int measuredHeight) {
         float realHeight = PixelUtil.toDIPFromPixel(measuredHeight);
 
+        // If the state wrapper is null, we can't update the state, let's wait until it's set.
+        if (mStateWrapper == null) {
+            return;
+        }
+
         // Check incoming state values. If they're already the correct value, return early to prevent
         // infinite UpdateState/SetState loop.
         ReadableMap currentState = mStateWrapper.getStateData();
                                                                                	
@suryapermana92work
Copy link

Library version: 2.9.0 React native version: 0.76.0, new architecture enabled

When opening react-native-picker, I get this error in runtime:

Process: app.florio.userfactor, PID: 29998
java.lang.NullPointerException: Attempt to invoke interface method 'com.facebook.react.bridge.ReadableNativeMap com.facebook.react.uimanager.StateWrapper.getStateData()' on a null object reference
at com.reactnativecommunity.picker.FabricEnabledPicker.updateState(FabricEnabledPicker.java:45)
at com.reactnativecommunity.picker.FabricEnabledPicker.setMeasuredHeight(FabricEnabledPicker.java:32)
at com.reactnativecommunity.picker.ReactPicker.onMeasure(ReactPicker.java:226)

This patch seems to fix it:

diff --git a/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java b/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
index 08edd095d688be68fba52be667fc416a0d290b3b..925fc2b296151ba9325a3d9cd5fbd57454c232d5 100644
--- a/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
+++ b/android/src/fabric/java/com/reactnativecommunity/picker/FabricEnabledPicker.java
@@ -35,6 +35,11 @@ public abstract class FabricEnabledPicker extends AppCompatSpinner {
     void updateState(int measuredHeight) {
         float realHeight = PixelUtil.toDIPFromPixel(measuredHeight);
 
+        // If the state wrapper is null, we can't update the state, let's wait until it's set.
+        if (mStateWrapper == null) {
+            return;
+        }
+
         // Check incoming state values. If they're already the correct value, return early to prevent
         // infinite UpdateState/SetState loop.
         ReadableMap currentState = mStateWrapper.getStateData();
                                                                                	

do you have patch for ios? it's look for patching android right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants