Skip to content

[General] Replace enabled with disabled prop on Clickable#4057

Open
j-piasecki wants to merge 1 commit intomainfrom
@jpiasecki/clickable-disabled
Open

[General] Replace enabled with disabled prop on Clickable#4057
j-piasecki wants to merge 1 commit intomainfrom
@jpiasecki/clickable-disabled

Conversation

@j-piasecki
Copy link
Copy Markdown
Member

Description

Replaces the existing enabled button with disabled. 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.

Copilot AI review requested due to automatic review settings April 3, 2026 11:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ClickableProps to remove enabled and add disabled.
  • Update Clickable implementation to map disabled to the underlying enabled prop.
  • 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.

Comment on lines 115 to 120
<ClickableButton
{...rest}
{...rippleProps}
ref={ref ?? null}
enabled={!disabled}
onBegin={onBegin}
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +18 to 19
export type ClickableProps = Omit<ButtonProps, RippleProps | 'enabled'> &
Omit<BaseButtonProps, keyof RawButtonProps> & {
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants