React-native-web: TypeError: Cannot read property 'createAnimatedComponent' of undefined

Created on 18 Jul 2018  路  4Comments  路  Source: necolas/react-native-web

The problem
After update from RNW 0.6.1 to 0.8.8 all unit tests broken with error:

TypeError: Cannot read property 'createAnimatedComponent' of undefined

How to reproduce

Steps to reproduce:

  1. Update to last version

Expected behavior
Tests passed

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.8.8
  • React (version): 16.3.2
  • Browser: Electron (Chrome)

Additional context

  • react-test-renderer 16.4.1
  • react-native 0.56.0

Error report
All tests has same error.

Test suite failed to run

    TypeError: Cannot read property 'createAnimatedComponent' of undefined

      42 | export { durableAxios, axiosWithIdleTimeout };
      43 |
    > 44 | export function copyToClipboard(text: string) {
      45 |   clipboard.writeText(text);
      46 | }
      47 |

      at Object.<anonymous> (node_modules/react-native-web/dist/cjs/exports/Animated/index.js:28:40)
      at Object.<anonymous> (node_modules/react-native-web/dist/cjs/index.js:50:15)
      at Object.<anonymous> (src/core/adapter.web.js:44:799)
      at Object.<anonymous> (src/utils/offline.js:3:81)
      at Object.<anonymous> (src/utils/cache.js:4:98)
      at Object.<anonymous> (test-setup.js:2:87)

p.s. May be it's not a bug with RNW, but I didn't find any information on the web, sorry.

Most helpful comment

My problem was inside moduleNameMapper option inside Jest config in package.json

Not worked: "react-native": "<rootDir>/node_modules/react-native-web",
Worked: "^react-native$": "react-native-web",

All 4 comments

Did you read through the release notes and look at the breaking changes? https://github.com/necolas/react-native-web/releases

@necolas sorry, can you clarify which point is related to this? (I read 0.8 and 0.7 breaking changes notes)

Make sure all the React packages are on the same version, and you have updated or removed the RNW babel plugin. There's no problem with the codesandbox or demos, so the issue is likely to be in your project configuration.

My problem was inside moduleNameMapper option inside Jest config in package.json

Not worked: "react-native": "<rootDir>/node_modules/react-native-web",
Worked: "^react-native$": "react-native-web",

Was this page helpful?
0 / 5 - 0 ratings

Related issues

buffaloDeveloper picture buffaloDeveloper  路  3Comments

ndbroadbent picture ndbroadbent  路  3Comments

PaulBGD picture PaulBGD  路  4Comments

zhangking picture zhangking  路  3Comments

necolas picture necolas  路  3Comments