Skip to content

Commit 7b564de

Browse files
committed
add fire event section
1 parent 3cb7b55 commit 7b564de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

website/docs/MigrationV7.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,16 @@ The `disabled` prop on "Touchable\*" components is treated in the same manner as
9595
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).
9696

9797
As a mitigation, you'll likely need to modify the logic of "touchable" components to bail if they're pressed in disabled state.
98+
99+
## Firing events changes
100+
101+
There are slight differences in how `fireEvent` works in both libraries:
102+
103+
1. Our library doesn't perform validation checks for events fired upon tested components.
104+
1. Signature is different:
105+
```diff
106+
-fireEvent[eventName](node: FiberRoot, eventProperties: NativeTestEvent)
107+
+fireEvent(element: ReactTestInstance, eventName: string, ...data: Array<any>)
108+
```
109+
1. There is no `NativeTestEvent` - second and rest arguments are used instead.
110+
1. There are only 3 short-hand events: [`fireEvent.press`](`/docs/api/#fireeventpress-element-reacttestinstance--void`), [`fireEvent.changeText`](https://callstack.github.io/react-native-testing-library/docs/api/#fireeventchangetext-element-reacttestinstance-data-arrayany--void), [`fireEvent.scroll`](https://callstack.github.io/react-native-testing-library/docs/api/#fireeventchangetext-element-reacttestinstance-data-arrayany--void). For all other or custom events you can use the base signature.

0 commit comments

Comments
 (0)