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

React Native components transform into generic one with shallow #2379

Closed
2 of 13 tasks
brian-perlego opened this issue Apr 16, 2020 · 3 comments
Closed
2 of 13 tasks

React Native components transform into generic one with shallow #2379

brian-perlego opened this issue Apr 16, 2020 · 3 comments

Comments

@brian-perlego
Copy link

Current behavior

After updating to React Native 62 some of my unit test are not working. The component is not rendered correctly using shallow(). For exemple if I try to shallow a component that include a TextInput and then I console log debug it I will receive this:

<Component autoCorrect={false} autoCapitalize="none" onFocus={[Function]} ... />

instead of what I got before

<TextInput autoCorrect={false} autoCapitalize="none" onFocus={[Function]} ... />

It's happening with other components (TouchableOpacity and TouchableHighlight)

Expected behavior

The React Native component to be the same instead of a generic one.

Your environment

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.10.0
react 16.11.0
react-native 0.62.2
react-dom 16.11.0
react-test-renderer 16.11.0

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )
@ljharb
Copy link
Member

ljharb commented Apr 17, 2020

See #1436 - without an official RN adapter, RN doesn't work properly with enzyme. enzyme-adapter-react-16 is for ReactDOM.

@gerryfletch
Copy link

I had the same issue with TouchableOpacity and TextInput. Found this discussion which lead to a workaround for me: facebook/react-native#27721

@brian-perlego
Copy link
Author

Thank you @gerryfletch, this fixed my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants