Add the appropriate “Tag” based on what Expo library you have a question on.
We are currently on SDK 45 and tried to upgrade to 46.
However, we encounter problems we are not sure about how to fix them.
Here is the error trace:
ERROR Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]'
ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Text@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:65796:27
Root
ExpoRoot@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:223483:22
RCTView
View
DevAppContainer@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:223230:36
RCTView
View
AppContainer@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:184801:36
main(RootComponent)@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:190723:28
ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Text@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:65796:27
Root
ExpoRoot@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:223483:22
RCTView
View
DevAppContainer@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:223230:36
RCTView
View
AppContainer@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:184801:36
main(RootComponent)@http://192.168.1.47:19000/index.bundle?platform=ios&dev=true&hot=false:190723:28
ERROR TypeError: null is not an object (evaluating 'dispatcher.useState')
This error is located at:
in Text
in Root (created by ExpoRoot)
in ExpoRoot
in RCTView (created by View)
in View (created by AppContainer)
in DevAppContainer (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in main(RootComponent)
My question is what exactly does
ERROR Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]'
mean and where does it originate from?
To keep things simple we modified our App.tsx to:
import React from 'react';
import { Text } from 'react-native';
export default function Root() {
return <Text>Test</Text>;
}
And our index.js is:
import { registerRootComponent } from 'expo';
import App from './App';
registerRootComponent(App);
We run this in a monorepo where other applications may have other react and react-dom versions. But even after downgrading them all to 18.0.0 this error in our mobile app persists.
Expo doctor says everything is
$ expo doctor
🎉 Didn't find any issues with the project!
This seems like an issue because the mobile app project is in a monorepo and is usually caused by multiple versions of a dependency. We recently updated the Monorepos guide to address this. Please refer modify the metro config section to use disableHierarchicalLookup which allows a monorepo to include multiple versions of the react package.
iOS Bundling complete 411ms
ERROR Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
@amanhimself I’m seeing this exact same issue with SDK 46 and yarn workspaces. I am not using hoisted per the default monorepo docs. The weird thing is expo go was working great for a while and just suddenly stopped with no changes in dependencies, now I’m not able to get expo to run at all.
I tried @nephix repo with yarn workspaces and experienced the same issue.
@brents ah, good catch thank you, if I nohoist the uuid dep it works. That makes sense, I guess I was confused since the expo docs mention not using hoisting. Relatively new to yarn workspaces so that was confusing. Thanks!
We chose to stay with npm workspaces and did the following to make it work:
Downgrade our uuid dependency to ^3.4.0 (same as used in Expo)
rm -rf package-lock.json in monorepo root
npm install in monorepo root
Then the uuid errors disappeared.
Hopefully npm is going to add a nohoist option for workspaces in the future so we can use uuid in more recent versions in other packages of our monorepo