Skip to content

Migrate Drawer to TS #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions generatedTypes/components/drawer/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import React, { PureComponent, RefObject } from 'react';
import { Animated, ViewStyle, TextStyle } from 'react-native';
import Swipeable, { PropType as SwipeableProps } from './Swipeable';
interface ItemProps {
width?: number;
background?: string;
text?: string;
icon?: number;
onPress?: Function;
keepOpen?: boolean;
style?: ViewStyle;
testID?: string;
}
interface DrawerProps {
/**
* The drawer animation bounciness
*/
bounciness?: number;
/**
* OnDragStart handler
*/
onDragStart?: Function;
/**
* The bottom layer's items to appear when opened from the right
*/
rightItems?: ItemProps[];
/**
* The bottom layer's item to appear when opened from the left (a single item)
*/
leftItem?: ItemProps;
/**
* Set a different minimum width
*/
itemsMinWidth?: number;
/**
* The color for the text and icon tint of the items
*/
itemsTintColor?: string;
/**
* The items' icon size
*/
itemsIconSize?: number;
/**
* The items' text style
*/
itemsTextStyle?: TextStyle;
/**
* Perform the animation in natively
*/
useNativeAnimations?: boolean;
/**
* Whether to allow a full left swipe
*/
fullSwipeLeft?: boolean;
/**
* Threshold for a left full swipe (0-1)
*/
fullLeftThreshold?: number;
/**
* Callback for left item full swipe
*/
onFullSwipeLeft?: Function;
/**
* Callback for left item toggle swipe
*/
onToggleSwipeLeft?: Function;
/**
* Callback for just before left item full swipe
*/
onWillFullSwipeLeft?: Function;
/**
* Whether to allow a full right swipe
*/
fullSwipeRight?: boolean;
/**
* Threshold for a right full swipe (0-1)
*/
fullRightThreshold?: number;
/**
* Callback for right item full swipe
*/
onFullSwipeRight?: Function;
/**
* Callback for just before right item full swipe
*/
onWillFullSwipeRight?: Function;
/**
* Haptic trigger function to use onToggleSwipeLeft
*/
leftToggleHapticTrigger?: Function;
/**
* Style
*/
style?: ViewStyle;
}
/**
* @description: Drawer Component
* @important: If your app works with RNN, your screen must be wrapped
* with gestureHandlerRootHOC from 'react-native-gesture-handler'. see
* @importantLink: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation
*/
declare class Drawer extends PureComponent<DrawerProps> {
static displayName: string;
static defaultProps: {
itemsTintColor: string;
itemsIconSize: number;
};
leftRender: SwipeableProps['renderLeftActions'];
rightRender: SwipeableProps['renderLeftActions'];
_swipeableRow: RefObject<Swipeable>;
animationOptions: SwipeableProps['animationOptions'];
leftActionX: Animated.Value;
constructor(props: DrawerProps);
private getLeftActionsContainerStyle;
private getRightActionsContainerStyle;
private getActionsContainerStyle;
/** Actions */
closeDrawer: () => void;
openLeft: () => void;
openLeftFull: () => void;
toggleLeft: () => void;
openRight: () => void;
openRightFull: () => void;
/** Events */
private onActionPress;
private onSwipeableWillOpen;
private onSwipeableWillClose;
private onToggleSwipeLeft;
private toggle;
/** Accessability */
private getAccessibilityActions;
private onAccessibilityAction;
/** Renders */
private renderLeftActions;
private renderRightActions;
private renderActions;
private renderAction;
render(): JSX.Element;
}
declare const _default: React.ComponentClass<DrawerProps & {
useCustomTheme?: boolean | undefined;
}, any> & typeof Drawer;
export default _default;
Loading