You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the library's components results in exception being thrown when running tests with Jest.
C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:2611
throw error;
^
TypeError: Cannot read properties of undefined (reading 'addEventListener')
at addEventListener (C:\ReactNativePaperJestTest\node_modules\react-native-paper\src\utils\addEventListener.tsx:19:31)
at C:\ReactNativePaperJestTest\node_modules\react-native-paper\src\core\PaperProvider.tsx:47:38
at commitHookEffectListMount (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:12999:26)
at commitPassiveMountOnFiber (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14422:11)
at commitPassiveMountEffects_complete (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14382:9)
at commitPassiveMountEffects_begin (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14369:7)
at commitPassiveMountEffects (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14357:3)
at flushPassiveEffectsImpl (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16248:3)
at flushPassiveEffects (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16197:14)
at C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16012:9
at workLoop (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:266:34)
at flushWork (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:239:14)
at Immediate.performWorkUntilDeadline (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:533:21)
at processImmediate (node:internal/timers:478:21)
Node.js v20.12.0
Expected behaviour
The test should run with no exceptions.
How to reproduce?
Create new app with npx react-native@latest init ReactNativePaperJestTest
C:\ReactNativePaperJestTest\node_modules\flow-parser\flow_parser.js:818
throw a}function
^
TypeError: Cannot read properties of undefined (reading 'addEventListener')
at addEventListener (C:\ReactNativePaperJestTest\node_modules\react-native-paper\src\utils\addEventListener.tsx:20:19)
at C:\ReactNativePaperJestTest\node_modules\react-native-paper\src\core\PaperProvider.tsx:100:39
at commitHookEffectListMount (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:12999:26)
at commitPassiveMountOnFiber (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14422:11)
at commitPassiveMountEffects_complete (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14382:9)
at commitPassiveMountEffects_begin (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14369:7)
at commitPassiveMountEffects (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:14357:3)
at flushPassiveEffectsImpl (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16248:3)
at flushPassiveEffects (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16197:14)
at C:\ReactNativePaperJestTest\node_modules\react-test-renderer\cjs\react-test-renderer.development.js:16012:9
at workLoop (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:266:34)
at flushWork (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:239:14)
at Immediate.performWorkUntilDeadline (C:\ReactNativePaperJestTest\node_modules\react-test-renderer\node_modules\scheduler\cjs\scheduler.development.js:533:21)
at processImmediate (node:internal/timers:478:21)
Node.js v20.12.0
Your Environment
software
version
react-native
0.73.6
react-native-paper
5.12.3
node
20.12.0
npm
10.5.0
The text was updated successfully, but these errors were encountered:
Current behaviour
Using the library's components results in exception being thrown when running tests with Jest.
Expected behaviour
The test should run with no exceptions.
How to reproduce?
npx react-native@latest init ReactNativePaperJestTest
PaperProvider
component to the appnpm test
Alternatively, check out this GitHub repo.
What have you tried so far?
Adding the following to
jest.config.js
:causes the error to change a bit:
Your Environment
The text was updated successfully, but these errors were encountered: