UNPKG

react-native-pressable-scale

Version:

A <PressableScale> and a supercharged <NativePressableScale> components for React Native

40 lines (39 loc) 1.29 kB
import React from 'react'; import type { ViewProps } from 'react-native'; import { TapGestureHandler } from 'react-native-gesture-handler'; import { WithSpringConfig } from 'react-native-reanimated'; export interface NativePressableScaleProps extends ViewProps, Partial<Omit<WithSpringConfig, 'mass'>> { children: React.ReactNode; /** * The value to scale to when the Pressable is being pressed. * @default 0.95 */ activeScale?: number; /** * The onPress event. */ onPress: () => void; /** * Set to `true` if this Pressable is contained in a list. This will automatically delay the scale animation. * @default false */ isInList?: boolean; /** * The weight physics of this button * @default 'heavy' */ weight?: 'light' | 'medium' | 'heavy'; /** * Set to `true` to disable pressing * @default false */ disabled?: boolean; /** * Ref to the `TapGestureHandler` */ ref?: React.RefObject<TapGestureHandler>; } /** * A Pressable that scales down when pressed. Uses the native responder system from react-native-gesture-handler instead of the JS Pressability API. */ export declare function NativePressableScale(props: NativePressableScaleProps): React.ReactElement;