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

toBeVisible failing when used on Pressable with style function #133

Closed
kaibarnes opened this issue Nov 29, 2022 · 1 comment · Fixed by #134
Closed

toBeVisible failing when used on Pressable with style function #133

kaibarnes opened this issue Nov 29, 2022 · 1 comment · Fixed by #134

Comments

@kaibarnes
Copy link
Contributor

  • react-native or expo: react-native
  • @testing-library/react-native version: 5.3.0
  • jest-preset: jest-expo
  • react-native version: 0.68.5
  • node version: 16.16.0

What happened:

When using .toBeVisible on a Pressable using a function for the style prop we get the following error

TypeError: Cannot destructure property 'display' of 'react_native_1.StyleSheet.flatten(...)' as it is undefined.

at isStyleVisible (node_modules/@testing-library/jest-native/dist/to-be-visible.js:9:13)

Using a function in the style prop is used for checking whether the component is currently pressed, so I think it needs to be supported.

Can you help us fix this issue by submitting a pull request?

I can make a fix for this myself.

@kaibarnes
Copy link
Contributor Author

I've made #134 which appears to fix the 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

Successfully merging a pull request may close this issue.

1 participant