-
Notifications
You must be signed in to change notification settings - Fork 273
No handler function found with fireEvent.press on disabled TouchableOpacity #469
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
Comments
The "touchable" is disabled, so the handler won't be invoked, hence the error thrown. I think we could improve the wording to be more obvious here. |
cc @mdjastrzebski as he also has some thoughts on the topic :) |
So what is the correct option here to test a disabled touchable ? Something like
? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Andarius I think your original complain is a valid point. So However the case when there is event handler but is disabled should probably be handled without throwing error. |
We've just released 7.0.1 which now doesn't throw. So please adjust your tests to something like this: fireEvent.press(getByTestId('testBtn'));
expect(handlePress).not.toHaveBeenCalled(); |
Describe the bug
When running
fireEvent.press
on a disabled TouchableOpacity, the following error appears:No handler function found for event: "press"
Expected behavior
Should not raise an error
Steps to Reproduce
Run the following
Versions
The text was updated successfully, but these errors were encountered: