You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Android crashes due to NullPointerException in RuntimeUtils.java when using the keyboard input features. The issue stems from the React Native UI Lib package's dependency structure for Android, where patches need to be applied to both react-native-ui-lib AND uilib-native packages.
Related to
Components
Demo
Docs
Typings
Steps to reproduce
Use react-native-ui-lib in a React Native application
Implement components that use keyboard-related features
Run on Android
App crashes with NullPointerException in RuntimeUtils.java during keyboard interaction
Apply patch to react-native-ui-lib but crashes continue
Expected behavior
The app should handle keyboard interactions properly without crashing.
Actual behavior
The app crashes with errors like:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void com.facebook.react.uimanager.UIManagerModule.onBatchComplete()' on a null object reference
at com.wix.reactnativeuilib.keyboardinput.utils.RuntimeUtils$1.run(RuntimeUtils.java:13)
More Info
Root Cause Analysis
The root cause of this issue is a non-obvious relationship between react-native-ui-lib and uilib-native packages.
When building the Android app, the react-native-ui-lib package doesn't use its own native Android code. Instead, it points to the uilib-native package's Android code, as configured in react-native-ui-lib/react-native.config.js:
// node_modules/react-native-ui-lib/react-native.config.jsmodule.exports={dependency: {platforms: {android: {sourceDir: "../uilib-native/android/",// Other config...},},},};
This means that patching only react-native-ui-lib doesn't affect the Android build, since it's actually using code from uilib-native.
Thanks @wasimkham for the putting all together on the issue. I am experiencing the same for past couple of days. Tried to patch react-native-ui-lib , but didn't work. I'll try patching uilib-native as well. What I notice is the app crashes after the keyboard appears. Even tried upgrading react-native-screens, then using KeyboardAvoidingView and KeyboardAwareScrollView with no luck. Only fix works is if we change in the AndroidMainfest.xml file android:windowSoftInputMode="adjustResize" to android:windowSoftInputMode="adjustNothing". But consequences would be hard to handle. adjustPan doesn't work either. I hope the team will provide a help soon or if you can create a PR please.
Description
Android crashes due to
NullPointerException
inRuntimeUtils.java
when using the keyboard input features. The issue stems from the React Native UI Lib package's dependency structure for Android, where patches need to be applied to bothreact-native-ui-lib
ANDuilib-native
packages.Related to
Steps to reproduce
react-native-ui-lib
in a React Native applicationNullPointerException
inRuntimeUtils.java
during keyboard interactionreact-native-ui-lib
but crashes continueExpected behavior
The app should handle keyboard interactions properly without crashing.
Actual behavior
The app crashes with errors like:
More Info
Root Cause Analysis
The root cause of this issue is a non-obvious relationship between
react-native-ui-lib
anduilib-native
packages.When building the Android app, the
react-native-ui-lib
package doesn't use its own native Android code. Instead, it points to theuilib-native
package's Android code, as configured inreact-native-ui-lib/react-native.config.js
:This means that patching only
react-native-ui-lib
doesn't affect the Android build, since it's actually using code fromuilib-native
.Code snippet
Original problematic code in
uilib-native
:Fixed version with proper null checks:
Solution
To fix this issue, you need to patch both packages using
patch-package
:react-native-ui-lib
uilib-native
patch-package
in your postinstall scriptExample patches are provided in the code snippets above.
Verification
To verify that patches are correctly applied:
Log.d("TAG", "message")
)Screenshots/Video
N/A
Environment
Affected platforms
Reference: facebook/react-native#47662
The text was updated successfully, but these errors were encountered: