-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
TypeError: this._touchableNode.addEventListener is not a function #720
Comments
You probably need to configure jest to run with jsdom. See https://github.com/necolas/react-native-web/blob/master/package.json |
@necolas i'm seeing this too. Could you re-open the issue? Or shall I create a new one? I took the demo from @jribeiro and added jest config as per the RNW config - https://github.com/toboid/react-native-web-touchable-demo/blob/master/jest.json I'm still seeing the issue and I'm seeing it in the project I work on too. |
The root cause of the issue looks to be that I'll wrap that code in a guard to avoid the error getting thrown. |
OK great, I'd be happy to be create a PR if you like? |
The object returned by 'ReactDOM.findDOMNode' when rendered by 'react-test-renderer' doesn't match the DOM API for an element. Only attempt to bind the listener if 'addEventListener' is present on the object. Fix #720
No worries, should already be fixed in master. Thanks for following up on this issue and helping me to understand what the issue was |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When running Jest snapshots on a
Button
component imported from React Native and usingreact-native-web/babel
or aliasing through webpack, an exception is thrown:The error seems to come from this line:
https://github.com/necolas/react-native-web/blob/master/src/components/Touchable/Touchable.js#L332
If the current behavior is a bug, please provide the steps to reproduce and
if a minimal demo of the problem via Glitch or similar (template:
https://glitch.com/edit/#!/react-native-web-playground).
Button
What is the expected behavior?
Snapshot should be created
Environment (include versions). Did this work in previous versions?
I've created a demo repo showcasing the issue
https://github.com/jribeiro/react-native-web-touchable-demo
The text was updated successfully, but these errors were encountered: