Pressable

By providing access to hover, pressed, and focus events, Pressable serves as a more flexible alternative to buttons at a lower level of abstraction. It is a useful primitive for advanced customization needs.
Installation
API Reference
This is an illustration of Pressable component.
<Pressable
onPress={() => console.log("Hello")}
p="$5"
bg="$primary500"
$hover-bg="$primary400"
>
<Text color="$text0">Press me</Text>
</Pressable>

Installation

Step 1: Install the following dependencies:

npm i @gluestack-ui/pressable

Step 2: Copy and paste the following code into your project.

import { styled } from "@gluestack-style/react"
import { Pressable as RNPressable } from "react-native"
export const Pressable = styled(RNPressable, {
_web: {
":focusVisible": {
outlineWidth: "2px",
outlineColor: "$primary700",
outlineStyle: "solid",
},
},
})

Step 3: Update the import paths to match your project setup.

API Reference

To use this component in your project, include the following import statement in your file.
import { Pressable } from "@/components/ui/Pressable"
export default () => <Pressable />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Pressable

It inherits all the properties of React Native's Pressable component.
Edit this page on GitHub