From fd26b7b0a2bdd2d450b8aecceed60fc78a3c3741 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Sat, 24 Jun 2017 19:31:47 +0300 Subject: [PATCH] SwipeViewsProps updated. --- types/react-swipeable-views/index.d.ts | 66 ++++++++++++++++---------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/types/react-swipeable-views/index.d.ts b/types/react-swipeable-views/index.d.ts index b146983efa..fd4b322fd5 100644 --- a/types/react-swipeable-views/index.d.ts +++ b/types/react-swipeable-views/index.d.ts @@ -7,34 +7,50 @@ import * as React from 'react'; -export as namespace ReactSwipeableViews; +export type OnChangeIndexCallback = (index: number, indexLatest: number) => void; -export type OnChangeIndexCallback = (indexNew: number, indexLatest: number) => void; -export type OnSwitchingCallback = (index: number) => void; +export type OnTransitionEndCallback = () => void; -declare namespace ReactSwipeableViews { - interface SwipeableViewsProps extends React.Props { - containerStyle?: React.CSSProperties; - disabled?: boolean; - index?: number; - onChangeIndex?: OnChangeIndexCallback; - onSwitching?: OnSwitchingCallback; - resistance?: boolean; - slideStyle?: React.CSSProperties; - style?: React.CSSProperties; - threshold?: number; - } +export type OnSwitchingCallback = (index: number, type: OnSwitchingCallbackTypeDescriptor) => void; - interface SwipeableViewsState { - indexCurrent?: number; - indexLatest?: number; - isDragging?: boolean; - isFirstRender?: boolean; - heightLatest?: number; - } +export type OnSwitchingCallbackTypeDescriptor = "move" | "end"; - class SwipeableViews extends React.Component { - } +export type AxisType = "x" | "x-reverse" | "y" | "y-reverse"; + +export interface SpringConfig { + duration: string; + easeFunction: string; + delay: string; } -export default ReactSwipeableViews.SwipeableViews; +export interface SwipeableViewsProps extends React.HTMLProps { + animateHeight?: boolean; + animateTransitions?: boolean; + axis?: AxisType; + containerStyle?: React.CSSProperties; + disabled?: boolean; + enableMouseEvents?: boolean; + hysteresis?: number; + ignoreNativeScroll?: boolean; + index?: number; + onChangeIndex?: OnChangeIndexCallback; + onSwitching?: OnSwitchingCallback; + onTransitionEnd?: OnTransitionEndCallback; + resistance?: boolean; + style?: React.CSSProperties; + slideStyle?: React.CSSProperties; + springConfig?: SpringConfig; + slideClassName?: string; + threshold?: number; +} + +export interface SwipeableViewsState { + indexCurrent?: number; + indexLatest?: number; + isDragging?: boolean; + isFirstRender?: boolean; + heightLatest?: number; + displaySameSlide?: boolean; +} + +export default class SwipeableViews extends React.Component { }