question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Hook Call with >=v1.4.18

See original GitHub issue

I am running an iOS (non-web) app on dripsy v1.4.17 but when I upgrade to v1.4.18 or v1.15.16 I get the following error:

[1]  | [0]  WARN  RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
[1]  | [0]  ERROR  Error: 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]  | [0] 1. You might have mismatching versions of React and the renderer (such as React DOM)
[1]  | [0] 2. You might be breaking the Rules of Hooks
[1]  | [0] 3. You might have more than one copy of React in the same app
[1]  | [0] See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
[1]  | [0] 
[1]  | [0] This error is located at:
[1]  | [0]     in ThemeProvider (at provider/index.tsx:33)
[1]  | [0]     in DripsyProvider (at App.tsx:49)
[1]  | [0]     in ApolloProvider (at App.tsx:48)
[1]  | [0]     in App (at renderApplication.js:47)
[1]  | [0]     in RCTView (at View.js:34)
[1]  | [0]     in View (at AppContainer.js:107)
[1]  | [0]     in RCTView (at View.js:34)
[1]  | [0]     in View (at AppContainer.js:134)
[1]  | [0]     in AppContainer (at renderApplication.js:40)

Was there something that changed significantly between these two patch-level versions? Any ideas as to what is causing this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JackCAcommented, Apr 30, 2021

No I cannot. Apologies for the noise.

It looks like this was a yarn workspace issue that I spent quite a bit of time tracking down. I ended up upgrading to yarn 2 and using noHoistingLimits and now no longer have any react-native special-casing for workspaces which is win-win.

0reactions
JackCAcommented, May 3, 2021

Could you elaborate on 1? I’m not exactly familiar with what hoisting is (or how metro works) but I’d be really interested in solving this.

I was using a vanilla react-native app so I don’t think you can use expo-yarn-workspaces with one (I tried at least). I also tried https://www.npmjs.com/package/react-native-yarn-workspaces-v2 which didn’t work either. There were hacks I had to do to make react-native pick up the correct directories and such.

Was upgrading to yarn 2 an issue?

Not at all in my situation. It’s the second time I’ve upgraded and I’ve been really happy with it. I followed this guide .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid Hook Call Warning - React
Invalid Hook Call Warning. You are probably here because you got the following error message: Hooks can only be called inside the body...
Read more >
React hooks: Invalid hook call - Stack Overflow
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of...
Read more >
Solving React Hooks' invalid hook call warning - Rob Kendal
Building a React project and have the error 'Hooks can only be called inside the body of a function component'? We'll solve the...
Read more >
Invalid hook call #485 - lawnstarter/react-native-picker-select
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of...
Read more >
Invalid hook call error - Shakacode
js:1465 Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found