DefinitelyTyped/types/react-swipeable-views-utils/index.d.ts
Robert Gabriel Nisipeanu 6577100e95
['react-swipeable-views-utils'] Add missing 'virtualized' and 'bindKeyboard' functions (#42336)
* Added missing 'virtualized' and 'bindKeyboard' functions for react-swipeable-views-utils

* Revert "Added missing 'virtualized' and 'bindKeyboard' functions for react-swipeable-views-utils"

This reverts commit a04ff4db27a444480d78d34fe2434231fc6dc066.

* Added missing 'virtualized' and 'bindKeyboard' functions for react-swipeable-views-utils-tests

* Added children prop for `virtualize`

* Fixed `Bind element 'number' has an 'any' type` error

* Fixed `file should end with a newline` error
2020-02-19 16:44:20 -08:00

61 lines
2.1 KiB
TypeScript

// Type definitions for react-swipeable-views-utils 0.13
// Project: https://github.com/oliviertassinari/react-swipeable-views#react-swipeable-views
// Definitions by: Sebastian Silbermann <https://github.com/eps1lon>
// Robert Nisipeanu <https://github.com/robertnisipeanu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import * as React from 'react';
import { ConsistentWith, Omit, PropInjector } from '@material-ui/types';
import { OnChangeIndexCallback, OnSwitchingCallback, OnTransitionEndCallback } from 'react-swipeable-views';
export interface WithAutoPlay {
index: number;
onChangeIndex: OnChangeIndexCallback;
onSwitching?: OnSwitchingCallback;
}
export interface WithAutoPlayProps {
autoplay?: boolean;
direction?: 'incremental' | 'decremental';
index: number;
interval?: number;
onChangeIndex: OnChangeIndexCallback;
slideCount?: number;
}
export interface WithVirtualize {
index: number;
onChangeIndex: OnChangeIndexCallback;
slideRenderer: (render: SlideRendererCallback) => React.ReactNode;
}
export interface WithVirtualizeProps {
index: number;
onChangeIndex: OnChangeIndexCallback;
onTransitionEnd?: OnTransitionEndCallback;
overscanSlideAfter?: number;
overscanSliedBefore?: number;
slideCount?: number;
children?: React.ReactNode;
slideRenderer: SlideRendererCallback;
}
export interface SlideRenderProps {
index: number;
key: number;
}
export interface WithBindKeyboard {
index: number;
onChangeIndex: OnChangeIndexCallback;
}
export interface WithBindKeyboardProps {
axis?: "x" | "x-reverse" | "y" | "y-reverse";
index: number;
onChangeIndex: OnChangeIndexCallback;
slidecount?: number;
}
export const autoPlay: PropInjector<WithAutoPlay, WithAutoPlayProps>;
export type SlideRendererCallback = (render: SlideRenderProps) => React.ReactNode;
export const virtualize: PropInjector<WithVirtualize, WithVirtualizeProps>;
export const bindKeyboard: PropInjector<WithBindKeyboard, WithBindKeyboardProps>;