Skip to content
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

Cannot read property 'decelerationRate' of undefined #889

Closed
shilman opened this issue Apr 15, 2017 · 4 comments
Closed

Cannot read property 'decelerationRate' of undefined #889

shilman opened this issue Apr 15, 2017 · 4 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 15, 2017

Issue by xareelee
Thursday Mar 16, 2017 at 09:26 GMT
Originally opened as storybook-eol/storyshots#86


When I use jest/storyshots to run the snapshot tests. It shows an abnormal error (TypeError: Cannot read property 'decelerationRate' of undefined ):

 FAIL  storybook/Storyshots.test.js
  ● Storyshots › [Page] CountryPolicy › entry

    TypeError: Cannot read property 'decelerationRate' of undefined
      
      at Object.<anonymous> (node_modules/react-native/Libraries/Components/WebView/WebView.ios.js:555:3254)
      at Object.get WebView [as WebView] (node_modules/react-native/Libraries/react-native/react-native.js:68:22)
      at CountryPolicy (src/ui/CountryPolicy/CountryPolicy.js:11:43)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:306:16
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at ReactCompositeComponentWrapper._constructComponentWithoutOwner (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:305:14)
      at ReactCompositeComponentWrapper._constructComponent (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:280:21)

Source code:

// CountryPolicy.jsx
const CountryPolicy = () => (
  <WebView
    style={styles.wrapper}
    source={{ uri: policyUrl }}
  />
) 

Story:

// CountryPolicy.stories.js
storiesOf('[Page] CountryPolicy', module)
  .add('entry', () => (
    <CountryPolicy />
  ));

The app displays normally. It seems something wrong when testing a DOM containing a WebView.

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by jrdrg
Friday Mar 17, 2017 at 12:45 GMT


Possibly the same issue referenced in storybook-eol/storyshots#76?

@tmeasday
Copy link
Member

@xareelee - did you have any luck with this one? It sounds like an issue with React Native's implementation of the <WebView/> component which is still unresolved: facebook/react-native#12440.

Is there anything we can do to avoid the problem? It sounds like the issue is with refs inside the WebView so I don't think the issue @shilman mentioned above will help (although I'm not sure).

I'll close this for now, but @-me or comment on this issue if there is something we could do to work around it.

@xareelee
Copy link

@tmeasday

Currently, I fixed this by adding jest.unmock('ScrollView') in the .fest_config.js which is mentioned on facebook/react-native#12440 (comment).

It seems that React Native team should fix the issue.

@tmeasday
Copy link
Member

@xareelee OK, thanks for posting that, hopefully it will help anyone else who runs into this problem!

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

3 participants