[General] Replace enabled with disabled prop on Clickable#4057
[General] Replace enabled with disabled prop on Clickable#4057j-piasecki wants to merge 1 commit intomainfrom
enabled with disabled prop on Clickable#4057Conversation
There was a problem hiding this comment.
Pull request overview
This PR renames Clickable’s touch-disabling API from enabled to disabled to better align with React Native’s Pressable conventions.
Changes:
- Update
ClickablePropsto removeenabledand adddisabled. - Update
Clickableimplementation to mapdisabledto the underlyingenabledprop. - Update the common-app Clickable stress test example to use
disabled.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react-native-gesture-handler/src/v3/components/Clickable/ClickableProps.ts | Updates the public prop surface to introduce disabled and omit enabled. |
| packages/react-native-gesture-handler/src/v3/components/Clickable/Clickable.tsx | Implements disabled by driving the underlying enabled prop. |
| apps/common-app/src/new_api/components/clickable_stress/index.tsx | Migrates the stress-test example usage from enabled to disabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <ClickableButton | ||
| {...rest} | ||
| {...rippleProps} | ||
| ref={ref ?? null} | ||
| enabled={!disabled} | ||
| onBegin={onBegin} |
There was a problem hiding this comment.
enabled passed by existing (non-TypeScript) consumers will now be ignored because ...rest is spread before an unconditional enabled={!disabled}. That means legacy usage like enabled={false} would silently re-enable the component (since disabled defaults to false). To avoid a behavioral breaking change, consider reading an enabled prop from props (even if it’s deprecated in types) and computing the final enabled state with clear precedence (e.g., disabled overrides enabled, otherwise default to enabled ?? true).
| export type ClickableProps = Omit<ButtonProps, RippleProps | 'enabled'> & | ||
| Omit<BaseButtonProps, keyof RawButtonProps> & { |
There was a problem hiding this comment.
This change removes enabled from the public ClickableProps type. If the goal is to rename rather than hard-remove, consider keeping enabled?: boolean as a deprecated alias for at least one release (with disabled taking precedence) to provide a smoother migration path for TypeScript users and to align with any runtime backward-compat handling.
Description
Replaces the existing
enabledbutton withdisabled. This aligns the API with RN's Pressable and seems more natural to use.Test plan
Verify that the new prop works on existing examples.