Expo 34 Issue: Invariant Violation

Please provide the following:

  1. SDK Version: 34
  2. Platforms(Android/iOS/web/all): Android/iOS

I just upgraded from version 33 to 34 and got the following error:

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

This error is located at:
in RCTView
in l
in Styled(l)
in RCTView
in l
in Styled(l)
in n
in p
in RCTView
in u
in RCTView
in u
in n
in o
in E
in RCTView
in n
in RCTView
in u
in PanGestureHandler
in n
in L
in RCTView
in n
in t
in C
in v
in p
in RCTView
in RCTView
in l
in RCTView
in n
in RCTView
in u
in RCTView
in u
in PanGestureHandler
in n
in S
in C
in p
in p
in C
in P
in n
in v
in RCTView
in RCTView
in c

nn
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:26115
f
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:34102
m
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:35374
Ur
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:44607
Qr
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:52488
na
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:72881
ra
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:73371
Oa
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:80972
Wa
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:80310
Aa
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:79323
sa
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:78013
enqueueSetState
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:96:29425
setState
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:65:2231
dispatch
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:740:1477

AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:702:741

AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:1102:730
f
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:45:155

AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:45:882
y
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:119:657
C
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:119:1021
callImmediates
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:119:3216
value
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:31:2873

AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:31:1264
value
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:31:2565
value
AppEntry.bundle?platform=ios&dev=false&minify=true&hot=false:31:1234

I have been trying to resolve this, but could not find a solution. downgrading to version 33 works fine.
Any ideas on how this could be solved?

Just from looking at that, I cant really glean anything to offer help. But just taking a guess…could it be an issue with a dependency that gets out of whack when upgrading Expo version? Maybe try running yarn upgrade after changing your expo version. Just a thought

Hey @prabinjoel,

Can you paste a screenshot of the error? Also, if you’re project isn’t overly complex, it may be worth creating a fresh and piece-by-piece adding your code to see where the error is being thrown. It may also be from a dependency in which case you could try adding each library one by one as well.

Cheers,
Adam

Just a guess, but do you have a component that might, under some circumstances, not return anything?

Thanks you for all your responses. After spending a bit of time, following worked:
1 - Downgraded to expo 33
2 - Follow the steps for expo 34 update
3 - npm/yarn Install specific packages where any error is shown
4 - Run ‘npx expo-codemod sdk33-imports’ → I think this is exactly what solved the issue.

2 Likes

I just ran into this today while seeing how to upgrade a snack using Svg from SDK <3.3 to SDK 3.4. If you do this:

import Svg from 'react-native-svg';
...
<Svg ...>
  <Svg.Circle .../>
</Svg>

instead of:

import Svg, { Circle } from 'react-native-svg';
...
<Svg ...>
  <Circle .../>
</Svg>

you will get this error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.