mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import SwipeableViews from 'react-swipeable-views';
|
|
import { autoPlay, virtualize, bindKeyboard, SlideRenderProps } from 'react-swipeable-views-utils';
|
|
|
|
const AutoPlaySwipeableViews = autoPlay(SwipeableViews);
|
|
const VirtualizeSwipeableViews = virtualize(SwipeableViews);
|
|
const BindKeyboardSwipeableViews = bindKeyboard(SwipeableViews);
|
|
|
|
function autoPlayTest() {
|
|
// $ExpectError
|
|
<AutoPlaySwipeableViews />;
|
|
<AutoPlaySwipeableViews
|
|
index={1}
|
|
onChangeIndex={(index: number) => {
|
|
// $ExpectType number
|
|
index;
|
|
}}
|
|
/>;
|
|
}
|
|
|
|
function virtualizeTest() {
|
|
// $ExpectError
|
|
<VirtualizeSwipeableViews />;
|
|
<VirtualizeSwipeableViews
|
|
index={1}
|
|
onChangeIndex={(index: number) => {
|
|
index;
|
|
}}
|
|
slideRenderer={(renderer: SlideRenderProps) => {
|
|
return <div>Slide {renderer.index}</div>;
|
|
}}
|
|
/>;
|
|
}
|
|
|
|
function bindKeyboardTest() {
|
|
// $ExpectError
|
|
<BindKeyboardSwipeableViews />;
|
|
<BindKeyboardSwipeableViews
|
|
index={1}
|
|
onChangeIndex={(index: number) => {
|
|
index;
|
|
}}
|
|
/>;
|
|
}
|