react-native-pressable-opacity
Version:
A <PressableOpacity> and a supercharged <NativePressableOpacity> components for React Native
41 lines (40 loc) • 1.28 kB
TypeScript
import React from 'react';
import type { ViewProps } from 'react-native';
import { GestureType } from 'react-native-gesture-handler';
import { WithTimingConfig } from 'react-native-reanimated';
export interface NativePressableOpacityProps extends ViewProps, WithTimingConfig {
children: React.ReactNode;
/**
* The opacity to use when `disabled={true}`
*
* @default 0.3
*/
disabledOpacity?: number;
/**
* The opacity to use when the Pressable is being pressed.
* @default 0.2
*/
activeOpacity?: number;
/**
* The onPress event.
*/
onPress: () => void;
/**
* Set to `true` if this Pressable is contained in a list. This will automatically delay the press animation.
* @default false
*/
isInList?: boolean;
/**
* Set to `true` to disable pressing
* @default false
*/
disabled?: boolean;
/**
* Ref to the `GestureDetector`
*/
ref?: React.MutableRefObject<GestureType | undefined>;
}
/**
* A Pressable that lowers opacity when pressed. Uses the native responder system from react-native-gesture-handler instead of the JS Pressability API.
*/
export declare function NativePressableOpacity(props: NativePressableOpacityProps): React.ReactElement;