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

Attempt to invoke virtual method 'void.com.facebook.react.uimanager.UIManagerModule.onBatchComplete()' on a null object reference #3397

Open
2 of 7 tasks
muzhaqi16 opened this issue Nov 20, 2024 · 8 comments
Labels
bug a bug in one of the components waiting-for-response

Comments

@muzhaqi16
Copy link
Contributor

Description

Attempt to invoke virtual method 'void.com.facebook.react.uimanager.UIManagerModule.onBatchComplete()' on a null object reference

Related to

  • Components
  • Demo
  • Docs
  • Typings

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a new project with react-native": "^0.76"
  2. Setup react-native-ui-lib
  3. Add a TextField from react-native-ui-lib
  4. See error Attempt to invoke virtual method 'void.com.facebook.react.uimanager.UIManagerModule.onBatchComplete()' on a null object reference

Expected behavior

For the app not to crash

Actual behavior

App crashes

More Info

Code snippet

      <View flex paddingH-25 paddingT-120>
        <Text blue50 text20>
          Welcome
        </Text>
        <TextField text50 placeholder="username" grey10 />
        <TextField text50 placeholder="password" secureTextEntry grey10 />
        <View marginT-100 center>
          <Button text70 white background-orange30 label="Login" />
          <Button link text70 orange30 label="Sign Up" marginT-20 />
        </View>
      </View>

Screenshots/Video

Screenshot_20241116_193631_SousChefRN

Environment

System:
  OS: Windows 11 10.0.26100
  CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900HK
  Memory: 14.56 GB / 31.69 GB
Binaries:
  Node:
    version: 20.18.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.8.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20241103.093242.0
    path: C:\ProgramData\chocolatey\bin\watchman.EXE
SDKs:
  Android SDK:
    API Levels:
      - "34"
      - "35"
    Build Tools:
      - 34.0.0
      - 35.0.0
    System Images:
      - android-35 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
IDEs:
  Android Studio: AI-242.23339.11.2421.12550806
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.13
    path: /c/Program Files/Microsoft/jdk-17.0.13.11-hotspot/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.2
    wanted: 0.76.2
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
  • React Native version: "0.76.2"
  • React Native UI Lib version: "^7.34.2"
  • "react-native-gesture-handler": "^2.21.2",
  • "react-native-reanimated": "^3.16.1",

Affected platforms

  • Android
  • iOS
  • Web
@muzhaqi16 muzhaqi16 added the bug a bug in one of the components label Nov 20, 2024
@jameskennethrobinson
Copy link

Commenting out the following line in RuntimeUtils.java fixes the issue:

ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete();

Not sure what the long term solution is.

package com.wix.reactnativeuilib.keyboardinput.utils;

import com.facebook.react.uimanager.UIManagerModule;
import com.wix.reactnativeuilib.keyboardinput.ReactContextHolder;

public class RuntimeUtils {

    // TODO Switch to GuardedRunnable when upgrading RN's minimal ver
    private static final Runnable sUIUpdateClosure = new Runnable() {
        @Override
        public void run() {
            ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete();
        }
    };

    public static void runOnUIThread(Runnable runnable) {
        if (ReactContextHolder.getContext() != null) {
            ReactContextHolder.getContext().runOnUiQueueThread(runnable);
        }
    }

    public static void dispatchUIUpdates(final Runnable userRunnable) {
        runOnUIThread(new Runnable() {
            @Override
            public void run() {
                userRunnable.run();
                if (ReactContextHolder.getContext() != null) {
                    ReactContextHolder.getContext().runOnNativeModulesQueueThread(sUIUpdateClosure);
                }
            }
        });
    }
}

@adids1221
Copy link
Contributor

Hi @muzhaqi16 does it reproduce on project with RN 0.73 ?

@matice2
Copy link

matice2 commented Dec 18, 2024

still not fixed? 🙁

@JoseAIG
Copy link

JoseAIG commented Dec 20, 2024

Waiting for this fix

@AhmedMaqbool
Copy link

Having the same error can anybody recommend a fix till they resolve the issue

@adids1221
Copy link
Contributor

@matice2 @JoseAIG @AhmedMaqbool
Does the issue reproduce on RN 0.73?
Currently we are supporting RN 0.73, we will try to check this issue.

@AhmedMaqbool
Copy link

@matice2 @JoseAIG @AhmedMaqbool Does the issue reproduce on RN 0.73? Currently we are supporting RN 0.73, we will try to check this issue.

Okay this only works on 0.73 my project is using 0.76 any sort of timeline when you guys will start supporting 0.76

@subhranshuchoudhury
Copy link

I am getting the same error kindly fix it. i am only using the Carousel component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in one of the components waiting-for-response
Projects
None yet
Development

No branches or pull requests

7 participants