IjzerenHein / IjzerenHein/react-navigation-shared-element

[Jest] Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function

Open
#173 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

I'm getting this error when I run tests
`
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
`
I'm using jest and RNTL. The line of the problem is when declare the SharedElement component:

``````

Here my depedencies and devDependencies
```
"@apollo/client": "^3.3.18",
"react": "17.0.1",
"react-native": "0.64.1",
"react-native-shared-element": "^0.7.0",
"react-navigation-shared-element": "^5.0.0-alpha1",
},
"devDependencies": {
"@testing-library/react-hooks": "^7.0.0",
"@testing-library/react-native": "^7.2.0",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"react-test-renderer": "17.0.1"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Jest and React Native Testing Library warning with the SharedElement usage shown in the issue and the listed dependency versions. The issue does not name a project file or test, so first identify the relevant import and test entry point; done would mean determining why SharedElement is undefined and documenting or fixing the project-specific cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.