You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/MigrationV7.md
+6-8
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,12 @@ To improve compatibility with React Testing Library, and to ease the migration f
44
44
45
45
Please replace all occurrences of these queries in your codebase.
46
46
47
+
## `fireEvent` support for disabled components
48
+
49
+
To improve compatibility with real React Native environment `fireEvent` now performs checks whether the component is disabled before firing an event on it. The checks internally uses `onStartShouldSetResponder` prop to establish should event fire, which should resemble the actual React Native runtime.
50
+
51
+
If your code contained any workarounds for preventing events firing on disabled events, you should now be able to remove them.
52
+
47
53
# Guide for `@testing-library/react-native` users
48
54
49
55
This guide describes steps necessary to migrate from `@testing-library/react-native` from `v6.0` to `v7.0`. Although the name stays the same, this is a different library, sourced at [Callstack GitHub repository](https://github.com/callstack/react-native-testing-library). We made sure the upgrade path is as easy for you as possible.
@@ -87,14 +93,6 @@ Cleaning up (unmounting) components after each test is included by default in th
87
93
88
94
You can opt-out of this behavior by running tests with `RNTL_SKIP_AUTO_CLEANUP=true` flag or importing from `@testing-library/react-native/pure`. We encourage you to keep the default though.
89
95
90
-
## No special handling for `disabled` prop
91
-
92
-
The `disabled` prop on "Touchable\*" components is treated in the same manner as any other prop. We realize that with our library you can press "touchable" components even though they're in "disabled" state, however this is something that we strongly believe should be fixed upstream, in React Native core.
93
-
94
-
If you feel strongly about this difference, please send a PR to React Native, adding JavaScript logic to "onPress" functions, making them aware of disabled state in JS logic as well (it's handled on native side for at least iOS, which is the default platform that tests are running in).
95
-
96
-
As a mitigation, you'll likely need to modify the logic of "touchable" components to bail if they're pressed in disabled state.
97
-
98
96
## No [NativeTestInstance](https://www.native-testing-library.com/docs/api-test-instance) abstraction
99
97
100
98
We don't provide any abstraction over `ReactTestInstance` returned by queries, but allow to use it directly to access queried component's `props` or `type` for that example.
0 commit comments