UNPKG

3.01 kBTypeScriptView Raw
1import * as React from 'react';
2import { StyleProp, ViewStyle } from 'react-native';
3import type { NativeViewGestureHandlerProps } from '../handlers/NativeViewGestureHandler';
4export interface RawButtonProps extends NativeViewGestureHandlerProps {
5 /**
6 * Defines if more than one button could be pressed simultaneously. By default
7 * set true.
8 */
9 exclusive?: boolean;
10 /**
11 * Android only.
12 *
13 * Defines color of native ripple animation used since API level 21.
14 */
15 rippleColor?: any;
16 /**
17 * Android only.
18 *
19 * Defines radius of native ripple animation used since API level 21.
20 */
21 rippleRadius?: number | null;
22 /**
23 * Android only.
24 *
25 * Set this to true if you want the ripple animation to render outside the view bounds.
26 */
27 borderless?: boolean;
28 /**
29 * Android only.
30 *
31 * Defines whether the ripple animation should be drawn on the foreground of the view.
32 */
33 foreground?: boolean;
34 /**
35 * Android only.
36 *
37 * Set this to true if you don't want the system to play sound when the button is pressed.
38 */
39 touchSoundDisabled?: boolean;
40 /**
41 * Style object, use it to set additional styles.
42 */
43 style?: StyleProp<ViewStyle>;
44}
45interface ButtonWithRefProps {
46 innerRef?: React.ForwardedRef<React.ComponentType<any>>;
47}
48export interface BaseButtonProps extends RawButtonProps {
49 /**
50 * Called when the button gets pressed (analogous to `onPress` in
51 * `TouchableHighlight` from RN core).
52 */
53 onPress?: (pointerInside: boolean) => void;
54 /**
55 * Called when the button gets pressed and is held for `delayLongPress`
56 * milliseconds.
57 */
58 onLongPress?: () => void;
59 /**
60 * Called when button changes from inactive to active and vice versa. It
61 * passes active state as a boolean variable as a first parameter for that
62 * method.
63 */
64 onActiveStateChange?: (active: boolean) => void;
65 style?: StyleProp<ViewStyle>;
66 testID?: string;
67 /**
68 * Delay, in milliseconds, after which the `onLongPress` callback gets called.
69 * Defaults to 600.
70 */
71 delayLongPress?: number;
72}
73export interface BaseButtonWithRefProps extends BaseButtonProps, ButtonWithRefProps {
74}
75export interface RectButtonProps extends BaseButtonProps {
76 /**
77 * Background color that will be dimmed when button is in active state.
78 */
79 underlayColor?: string;
80 /**
81 * iOS only.
82 *
83 * Opacity applied to the underlay when button is in active state.
84 */
85 activeOpacity?: number;
86}
87export interface RectButtonWithRefProps extends RectButtonProps, ButtonWithRefProps {
88}
89export interface BorderlessButtonProps extends BaseButtonProps {
90 /**
91 * iOS only.
92 *
93 * Opacity applied to the button when it is in an active state.
94 */
95 activeOpacity?: number;
96}
97export interface BorderlessButtonWithRefProps extends BorderlessButtonProps, ButtonWithRefProps {
98}
99export {};