React-native-svg: TypeError : _this.getTouchableInitialState is not a function

Created on 11 Jul 2019  路  3Comments  路  Source: react-native-svg/react-native-svg

Question

Hi, I recently upgraded react-native-svg to latest version 9.5.1 when running in a device it is working fine but when running test cases I am getting an error like this

    TypeError: _this.touchableGetInitialState is not a function

      at Svg.touchableGetInitialState (node_modules/react-native-svg/elements/Shape.js:20:23)
      at new Svg (node_modules/react-native-svg/elements/Svg.js:65:121)
      at constructClassInstance (node_modules/react-dom/cjs/react-dom.development.js:11312:18)
      at constructClassInstance (node_modules/react-dom/cjs/react-dom.development.js:14483:5)
      at updateClassComponent (node_modules/react-dom/cjs/react-dom.development.js:15440:16)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:19108:12)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:19148:24)
      at workLoop (node_modules/react-dom/cjs/react-dom.development.js:19231:7)
      at renderRoot (node_modules/react-dom/cjs/react-dom.development.js:20138:7)
      at performWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:19886:7)

Is there anything I am missing?

React Native Environment Info:

System:
      OS: macOS 10.14.5
      CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
      Memory: 207.70 MB / 8.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.16.0 - /usr/local/Cellar/yvm/3.5.0/shim/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    npmPackages:
      react: 16.8.3 => 16.8.3
      react-native: 0.59.10 => 0.59.10
      jsdom: 15.1.1,
      react-test-renderer: 16.8.3,
      react-native-svg: 9.5.1,
      enzyme: 3.10.0,
      jest: 24.8.0
good first issue help wanted maybe fixed reproduction needed

Most helpful comment

@Dineshchitta using https://github.com/FormidableLabs/react-native-svg-mock fixed the issue

All 3 comments

Hmm, at least seems to work fine for me with the latest version / a clean react-native init: https://github.com/msand/VariableFontWeightAnimation/commit/7d87235c5d38e01a37bd3592e794acfa3e235b93
Seems you're using react-dom, are you making a universal web / native app?

@msand Yeah, I am using react native mock render which requires react-dom. I am making native app only. Not for web

@Dineshchitta using https://github.com/FormidableLabs/react-native-svg-mock fixed the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neiker picture neiker  路  3Comments

r0st1kuzh picture r0st1kuzh  路  3Comments

SyedShahbazHussain picture SyedShahbazHussain  路  3Comments

dquilter picture dquilter  路  3Comments

guiguithub picture guiguithub  路  3Comments