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

Error: dispatchViewManagerCommand: found null reactTag, js engine: hermes #295

Open
l3utterfly opened this issue Feb 27, 2025 · 0 comments

Comments

@l3utterfly
Copy link

l3utterfly commented Feb 27, 2025

Sometimes during setInputState, I get this error, which crashes the app on release APK builds: Error: dispatchViewManagerCommand: found null reactTag, js engine: hermes

I managed to fix it by adding a null check in this file Rive.tsx, but I'm not sure why this occurs yet.

const setInputState = useCallback<RiveRef['setInputState']>(
      (triggerStateMachineName, inputName, value) => {
        // added null check
        let nodeHandle = findNodeHandle(riveRef.current);
        if(nodeHandle === null) {
          console.error('RiveRef is not available');
          return;
        }

        if (typeof value === 'boolean') {
          UIManager.dispatchViewManagerCommand(
            findNodeHandle(riveRef.current),
            ViewManagerMethod.setBooleanState,
            [triggerStateMachineName, inputName, value]
          );
        } else if (typeof value === 'number') {
          UIManager.dispatchViewManagerCommand(
            findNodeHandle(riveRef.current),
            ViewManagerMethod.setNumberState,
            [triggerStateMachineName, inputName, value]
          );
        }
      },
      []
    );
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

1 participant