Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

Pressable

Pressable is a Core Component wrapper that can detect various stages of press interactions on any of its defined children.

Copied to clipboard.


<Pressable onPress={onPressFunction}>
  <Text>I'm pressable!</Text>
</Pressable>

How it works

On an element wrapped by Pressable:

  • onPressIn is called when a press is activated.
  • onPressOut is called when the press gesture is deactivated.

After pressing onPressIn, one of two things will happen:

  1. The person will remove their finger, triggering onPressOut followed by onPress.
  2. If the person leaves their finger longer than 500 milliseconds before removing it, onLongPress is triggered. (onPressOut will still fire when they remove their finger.)
Diagram of the onPress events in sequence.

Fingers are not the most precise instruments, and it is common for users to accidentally activate the wrong element or miss the activation area. To help, Pressable has an optional HitRect you can use to define how far a touch can register away from the wrapped element. Presses can start anywhere within a HitRect.

PressRect allows presses to move beyond the element and its HitRect while maintaining activation and being eligible for a "press"—think of sliding your finger slowly away from a button you're pressing down on.

Diagram of HitRect and PressRect and how they work.

You can set HitRect with hitSlop and set PressRect with pressRetentionOffset.

Example

Copied to clipboard.


import React, {useState} from 'react';
import {Pressable, StyleSheet, Text, View} from 'react-native';
import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context';

const App = () => {
  const [timesPressed, setTimesPressed] = useState(0);

  let textLog = '';
  if (timesPressed > 1) {
    textLog = timesPressed + 'x onPress';
  } else if (timesPressed > 0) {
    textLog = 'onPress';
  }

  return (
    <SafeAreaProvider>
      <SafeAreaView style={styles.container}>
        <Pressable
          onPress={() => {
            setTimesPressed(current => current + 1);
          }}
          style={({pressed}) => [
            {
              backgroundColor: pressed ? 'rgb(210, 230, 255)' : 'white',
            },
            styles.wrapperCustom,
          ]}>
          {({pressed}) => (
            <Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
          )}
        </Pressable>
        <View style={styles.logBox}>
          <Text testID="pressable_press_console">{textLog}</Text>
        </View>
      </SafeAreaView>
    </SafeAreaProvider>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
  text: {
    fontSize: 16,
  },
  wrapperCustom: {
    borderRadius: 8,
    padding: 6,
  },
  logBox: {
    padding: 20,
    margin: 10,
    borderWidth: StyleSheet.hairlineWidth,
    borderColor: '#f0f0f0',
    backgroundColor: '#f9f9f9',
  },
});

export default App;

Props

android_disableSound Android

If true, doesn't play Android system sound on press.

Type Default
boolean false

android_ripple Android

Enables the Android ripple effect and configures its properties.

Type
RippleConfig

children

Either children or a function that receives a boolean reflecting whether the component is currently pressed.

Type
React Node

unstable_pressDelay

Duration (in milliseconds) to wait after press down before calling onPressIn.

Type
number

delayLongPress

Duration (in milliseconds) from onPressIn before onLongPress is called.

Type Default
number 500

disabled

Whether the press behavior is disabled.

Type Default
boolean false

hitSlop

Sets additional distance outside of element in which a press can be detected.

Type
Rect or number

onHoverIn

Called when the hover is activated to provide visual feedback.

Type
({ nativeEvent: MouseEvent }) => void

onHoverOut

Called when the hover is deactivated to undo visual feedback.

Type
({ nativeEvent: MouseEvent }) => void

onLongPress

Called if the time after onPressIn lasts longer than 500 milliseconds. This time period can be customized with delayLongPress.

Type
({nativeEvent: PressEvent}) => void

onPress

Called after onPressOut.

Type
({nativeEvent: PressEvent}) => void

onPressIn

Called immediately when a touch is engaged, before onPressOut and onPress.

Type
({nativeEvent: PressEvent}) => void

onPressMove

Called when the press location moves.

Type
({nativeEvent: PressEvent}) => void

onPressOut

Called when a touch is released.

Type
({nativeEvent: PressEvent}) => void

pressRetentionOffset

Additional distance outside of this view in which a touch is considered a press before onPressOut is triggered.

Type Default
Rect or number {bottom: 30, left: 20, right: 20, top: 20}

style

Either view styles or a function that receives a boolean reflecting whether the component is currently pressed and returns view styles.

Type
View Style or ({ pressed: boolean }) => View Style

testOnly_pressed

Used only for documentation or testing (e.g. snapshot testing).

Type Default
boolean false

alexaEntityType Vega

alexaEntityType represents the value for the type of object that needs to be considered by Alexa UIController Interface. This is an optional prop and specific to Alexa UIController Interface support, it maps to the entity.type field from the Alexa UIController Interface (Alexa UIController API doc)

Type
enum('Thing', 'VideoObject', 'ItemList', 'SoftwareApplication')

alexaExternalIds Vega

This is an optional prop and specific to Alexa UIController Interface support, it maps to the entity.ExternalIds field from the Alexa UIController Interface (Alexa UIController API doc)

entity.ExternalIds are the identifiers for this entity unique within the scope of this endpoint. The entity.externalIds field will be opaque to Alexa and will only be used to include in directives from Alexa. The identifiers reported in entity.externalIds are required to be understood by the endpoint on all directive commands that accept an entity structure.

Type
object: {key: "string", value: "string"}

ariaPosInSet Vega

The value for ariaPosInSet refers to the number of the element when the user can refer to the element by number, such as "Alexa, select number one." the prop maps to ordinal property from Alexa UIController Interface (Alexa UIController API doc)

This prop is required if the app wants to allow user to perform voice selection based on the number.

Please note that providing the prop with a value does not result in the value being rendered automatically from the component, for a consistent user behavior, app needs to render the same ordinal value for the item.

Type
number

aria-label Vega

aria-label is an accessibility prop (reference to React Native Doc), it can also be used specify the name of the item in voice selection, such as "Alexa, select Prime Video".

This prop is required if the app wants to allow user to perform voice selection based on the name.

Please note that providing the prop with a value does not result in the value being render as the title of the component, app needs to explicted render the same text value for the item.

Type
string

altLabels Vega

The value for altLabels refers to the list of alternate names for the item. (Renamed from keplerAltLabels)

This prop is required if the app wants to allow user to perform voice selection on the same item with different names.

Type
Array of strings

enableSynchronousFocusEvents Vega

When set to true, onFocus/onBlur events will be dispatched synchronously, blocking the UI Thread until the JavaScript execution of onFocus/onBlur completes.

Type Required Platform
boolean No Vega

voiceOrdinal Vega

Add voiceOrdinal, used for ordinal selection for Voice Input.

Type
number

hasTVPreferredFocus iOS Vega TV

TV preferred focus. May be set to true to force the TV focus engine to move focus to this view.

Type Default
boolean false

isTVSelectable iOS Vega TV

When set to true, this view will be focusable and navigable using the TV remote.

Type
boolean

nextFocusDown Android Vega TV

Designates the next view to receive focus when the user navigates down. See the Android documentation.

Type
number

nextFocusForward Android Vega TV

Designates the next view to receive focus when the user navigates forward. See the Android documentation.

Type
number

nextFocusLeft Android Vega TV

Designates the next view to receive focus when the user navigates left. See the Android documentation.

Type
number

nextFocusRight Android Vega TV

Designates the next view to receive focus when the user navigates right. See the Android documentation.

Type
number

nextFocusUp Android Vega TV

Designates the next view to receive focus when the user navigates up. See the Android documentation.

Type
number

Type Definitions

RippleConfig Android

Ripple effect configuration for the android_ripple property.

Type
object

Properties:

Name Type Required Description
color color No Defines the color of the ripple effect.
borderless boolean No Defines if ripple effect should not include border.
radius number No Defines the radius of the ripple effect.
foreground boolean No Set to true to add the ripple effect to the foreground of the view, instead of the background. This is useful if one of your child views has a background of its own, or you're e.g. displaying images, and you don't want the ripple to be covered by them.

Last updated: May 13, 2026