Skip to content

SceneView crashes with "Element type is invalid" when component is passed correctly (React Native 0.79) #50789

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

Open
chooseongwoo opened this issue Apr 17, 2025 · 4 comments

Comments

@chooseongwoo
Copy link

Description

When using @react-navigation/native-stack with React Native 0.79.0, a fatal crash occurs in both Android and iOS:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
Check the render method of `SceneView`.

Even though the components passed into component={} are properly default exported, and verified with typeof === 'function', the SceneView still receives undefined and throws this error.

This occurs even after:

  • Clearing Metro bundler cache
  • Ensuring correct babel-plugin-module-resolver and tsconfig alias alignment
  • Verifying all components exist and export correctly
  • Reproducing in both iOS and Android builds

Steps to reproduce

  1. Set up a new React Native project (v0.79.0)

  2. Install @react-navigation/native, @react-navigation/native-stack

  3. Create a screen RegisterScreen.tsx with:

    const RegisterScreen = () => <View><Text>Register</Text></View>;
    export default RegisterScreen;
  4. Add to navigator:

    import RegisterScreen from '@/screens/(stack)/register';
    <Stack.Screen name="Register" component={RegisterScreen} />
  5. Run yarn android or yarn ios

  6. App crashes before rendering

React Native Version

0.79.0

Affected Platforms

Runtime - iOS, Runtime - Android, Build - MacOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 15.3.2
  CPU: (8) arm64 Apple M2
  Memory: 171.97 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.11.1
    path: ~/.nvm/versions/node/v20.11.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.11.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v20.11.1/bin/npm
  Watchman:
    version: 2025.04.14.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/chooseongwoo/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.24978.46.2431.13208083
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 22
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /Users/chooseongwoo/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.0
    wanted: 0.79.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
Check the render method of `SceneView`.

    at renderWithHooks
    at mountIndeterminateComponent
    at beginWork
    ...
    at SceneView (created by NativeStackViewInner)
    at Suspense (created by Freeze)
    at Freeze (created by DelayedFreeze)
    at DelayedFreeze (created by NativeStackViewInner)

Reproducer

https://github.com/chooseongwoo/spot

Screenshots and Videos

Image Image Image
@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.79.1. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@mateoguzmana
Copy link
Collaborator

By looking at your errors and reproducer, this seems like a problem specific to react-navigation. Have you tried opening an issue on their side?

@cipolleschi
Copy link
Contributor

@chooseongwoo Thanks for the issue. +1 to what @mateoguzmana said.
This looks more a react-navigation issue first. Please open the issue in their repository first. If that happens to be a bug in React Native, we will work together to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants