Skip to content

Conversation

@natew
Copy link
Contributor

@natew natew commented Dec 7, 2025

Summary

Exports the usePressability hook and related types (PressabilityConfig, PressabilityEventHandlers) from the public react-native API, enabling library authors to implement Pressable-quality press handling on custom components without deep imports.

Motivation

With deep imports being deprecated in 0.80 and removal planned for 0.82 (Discussion #893), libraries using usePressability need a public alternative.

Why not just use <Pressable>?

Pressable wraps content in a View, which:

  • Adds an extra layer to the view hierarchy
  • Can interfere with flex layout and styling
  • Requires wrapping every pressable element

usePressability allows applying press handling directly to existing View/Text components—the same pattern React Native uses internally for Text and TextInput.

Use Case

UI libraries like Tamagui use usePressability to provide press styles on styled View/Text primitives:

  • Smooth press + hold + move out behavior
  • Automatic cancellation when scrolling begins
  • Hit slop support
  • No wrapper View affecting layout

Internal Usage

Already used by React Native's own components:

  • Pressable.js
  • Text.js
  • TextInput.js

Changelog

[GENERAL] [ADDED] - Export usePressability hook and PressabilityConfig/PressabilityEventHandlers types from the public API

Test Plan

  • Existing Pressability tests pass
  • Export accessible via import { usePressability } from 'react-native'
  • TypeScript/Flow types correctly exported

Exports the usePressability hook and related types (PressabilityConfig,
PressabilityEventHandlers) from the public react-native API.

This enables library authors to implement Pressable-quality press handling
on custom components without deep imports, which are being deprecated in
0.80 and removed in 0.82.
@meta-cla
Copy link

meta-cla bot commented Dec 7, 2025

Hi @natew!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@react-native-bot
Copy link
Collaborator

Fails
🚫

📋 Missing Changelog - Please add a Changelog to your PR description. See Changelog format

Generated by 🚫 dangerJS against 333184a

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 8, 2025
@meta-cla
Copy link

meta-cla bot commented Dec 8, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 8, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 8, 2025

@huntie has imported this pull request. If you are a Meta employee, you can view this in D88645567.

@meta-codesync meta-codesync bot closed this in d0e9b9c Dec 9, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 9, 2025

@huntie merged this pull request in d0e9b9c.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Dec 9, 2025
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @natew in d0e9b9c

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants