|
| 1 | +import React, { PureComponent, RefObject } from 'react'; |
| 2 | +import { Animated, ViewStyle, TextStyle } from 'react-native'; |
| 3 | +import Swipeable, { PropType as SwipeableProps } from './Swipeable'; |
| 4 | +interface ItemProps { |
| 5 | + width?: number; |
| 6 | + background?: string; |
| 7 | + text?: string; |
| 8 | + icon?: number; |
| 9 | + onPress?: Function; |
| 10 | + keepOpen?: boolean; |
| 11 | + style?: ViewStyle; |
| 12 | + testID?: string; |
| 13 | +} |
| 14 | +interface DrawerProps { |
| 15 | + /** |
| 16 | + * The drawer animation bounciness |
| 17 | + */ |
| 18 | + bounciness?: number; |
| 19 | + /** |
| 20 | + * OnDragStart handler |
| 21 | + */ |
| 22 | + onDragStart?: Function; |
| 23 | + /** |
| 24 | + * The bottom layer's items to appear when opened from the right |
| 25 | + */ |
| 26 | + rightItems?: ItemProps[]; |
| 27 | + /** |
| 28 | + * The bottom layer's item to appear when opened from the left (a single item) |
| 29 | + */ |
| 30 | + leftItem?: ItemProps; |
| 31 | + /** |
| 32 | + * Set a different minimum width |
| 33 | + */ |
| 34 | + itemsMinWidth?: number; |
| 35 | + /** |
| 36 | + * The color for the text and icon tint of the items |
| 37 | + */ |
| 38 | + itemsTintColor?: string; |
| 39 | + /** |
| 40 | + * The items' icon size |
| 41 | + */ |
| 42 | + itemsIconSize?: number; |
| 43 | + /** |
| 44 | + * The items' text style |
| 45 | + */ |
| 46 | + itemsTextStyle?: TextStyle; |
| 47 | + /** |
| 48 | + * Perform the animation in natively |
| 49 | + */ |
| 50 | + useNativeAnimations?: boolean; |
| 51 | + /** |
| 52 | + * Whether to allow a full left swipe |
| 53 | + */ |
| 54 | + fullSwipeLeft?: boolean; |
| 55 | + /** |
| 56 | + * Threshold for a left full swipe (0-1) |
| 57 | + */ |
| 58 | + fullLeftThreshold?: number; |
| 59 | + /** |
| 60 | + * Callback for left item full swipe |
| 61 | + */ |
| 62 | + onFullSwipeLeft?: Function; |
| 63 | + /** |
| 64 | + * Callback for left item toggle swipe |
| 65 | + */ |
| 66 | + onToggleSwipeLeft?: Function; |
| 67 | + /** |
| 68 | + * Callback for just before left item full swipe |
| 69 | + */ |
| 70 | + onWillFullSwipeLeft?: Function; |
| 71 | + /** |
| 72 | + * Whether to allow a full right swipe |
| 73 | + */ |
| 74 | + fullSwipeRight?: boolean; |
| 75 | + /** |
| 76 | + * Threshold for a right full swipe (0-1) |
| 77 | + */ |
| 78 | + fullRightThreshold?: number; |
| 79 | + /** |
| 80 | + * Callback for right item full swipe |
| 81 | + */ |
| 82 | + onFullSwipeRight?: Function; |
| 83 | + /** |
| 84 | + * Callback for just before right item full swipe |
| 85 | + */ |
| 86 | + onWillFullSwipeRight?: Function; |
| 87 | + /** |
| 88 | + * Haptic trigger function to use onToggleSwipeLeft |
| 89 | + */ |
| 90 | + leftToggleHapticTrigger?: Function; |
| 91 | + /** |
| 92 | + * Style |
| 93 | + */ |
| 94 | + style?: ViewStyle; |
| 95 | +} |
| 96 | +/** |
| 97 | + * @description: Drawer Component |
| 98 | + * @important: If your app works with RNN, your screen must be wrapped |
| 99 | + * with gestureHandlerRootHOC from 'react-native-gesture-handler'. see |
| 100 | + * @importantLink: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation |
| 101 | + */ |
| 102 | +declare class Drawer extends PureComponent<DrawerProps> { |
| 103 | + static displayName: string; |
| 104 | + static defaultProps: { |
| 105 | + itemsTintColor: string; |
| 106 | + itemsIconSize: number; |
| 107 | + }; |
| 108 | + leftRender: SwipeableProps['renderLeftActions']; |
| 109 | + rightRender: SwipeableProps['renderLeftActions']; |
| 110 | + _swipeableRow: RefObject<Swipeable>; |
| 111 | + animationOptions: SwipeableProps['animationOptions']; |
| 112 | + leftActionX: Animated.Value; |
| 113 | + constructor(props: DrawerProps); |
| 114 | + private getLeftActionsContainerStyle; |
| 115 | + private getRightActionsContainerStyle; |
| 116 | + private getActionsContainerStyle; |
| 117 | + /** Actions */ |
| 118 | + closeDrawer: () => void; |
| 119 | + openLeft: () => void; |
| 120 | + openLeftFull: () => void; |
| 121 | + toggleLeft: () => void; |
| 122 | + openRight: () => void; |
| 123 | + openRightFull: () => void; |
| 124 | + /** Events */ |
| 125 | + private onActionPress; |
| 126 | + private onSwipeableWillOpen; |
| 127 | + private onSwipeableWillClose; |
| 128 | + private onToggleSwipeLeft; |
| 129 | + private toggle; |
| 130 | + /** Accessability */ |
| 131 | + private getAccessibilityActions; |
| 132 | + private onAccessibilityAction; |
| 133 | + /** Renders */ |
| 134 | + private renderLeftActions; |
| 135 | + private renderRightActions; |
| 136 | + private renderActions; |
| 137 | + private renderAction; |
| 138 | + render(): JSX.Element; |
| 139 | +} |
| 140 | +declare const _default: React.ComponentClass<DrawerProps & { |
| 141 | + useCustomTheme?: boolean | undefined; |
| 142 | +}, any> & typeof Drawer; |
| 143 | +export default _default; |
0 commit comments