-
Notifications
You must be signed in to change notification settings - Fork 272
feat: prevent events on disabled elements #460
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
Conversation
2d0f8f0
to
1ebd7ce
Compare
I've managed to implement this using This implementation captures the last host component when traversing up the element tree when looking for event handler. |
ddd63f8
to
44a9d27
Compare
Please update the migration guide accordingly as well :) |
Updated docs |
* feat: add tests * feat: prevent event handling on disabled element * refactor: code cleanup * feat: use props.onStartShouldSetResponder to check for event handling * refactor: code review changes * feat: updated docs * feat: added test for fake 'disabled' prop
* feat: add tests * feat: prevent event handling on disabled element * refactor: code cleanup * feat: use props.onStartShouldSetResponder to check for event handling * refactor: code review changes * feat: updated docs * feat: added test for fake 'disabled' prop
Summary
Prevent calling event handlers for disabled components.
Fixes #28
Test plan
Added tests for
TouchableOpacity
andPressable
in two configuration: lone element (expected throw no handler found) and nested elements: inner disabled, outer handling event.