mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-07 09:49:07 +00:00
react-swipeable-views-tests.ts updated.
This commit is contained in:
@@ -1,18 +1,35 @@
|
||||
import * as React from 'react';
|
||||
import SwipeableViews from 'react-swipeable-views';
|
||||
import SwipeableViews,
|
||||
{
|
||||
OnChangeIndexCallback,
|
||||
OnSwitchingCallback,
|
||||
OnSwitchingCallbackTypeDescriptor,
|
||||
OnTransitionEndCallback,
|
||||
SpringConfig
|
||||
} from 'react-swipeable-views';
|
||||
|
||||
const onChangeIndex = (indexNew: number, indexLatest: number) => {
|
||||
const onChangeIndex: OnChangeIndexCallback = (indexNew: number, indexLatest: number) => {
|
||||
console.log('New index: ' + indexNew + ', latest index' + indexLatest);
|
||||
};
|
||||
|
||||
const onSwitching = (index: number) => {
|
||||
console.log('Switching to ' + index);
|
||||
const onSwitching: OnSwitchingCallback = (index: number, type: OnSwitchingCallbackTypeDescriptor) => {
|
||||
console.log(`Switching to ${index} with transition type "${type}"`);
|
||||
};
|
||||
|
||||
const onTransitionEnd: OnTransitionEndCallback = () => {
|
||||
console.log("Transition end.");
|
||||
};
|
||||
|
||||
const style: React.CSSProperties = {
|
||||
height: 300
|
||||
};
|
||||
|
||||
const springConfig: SpringConfig = {
|
||||
duration: "0.5s",
|
||||
easeFunction: "cubic-bezier(0.1, 0.35, 0.2, 1)",
|
||||
delay: "0.5s",
|
||||
};
|
||||
|
||||
React.createElement(SwipeableViews, {
|
||||
containerStyle: style,
|
||||
disabled: false,
|
||||
@@ -22,7 +39,12 @@ React.createElement(SwipeableViews, {
|
||||
resistance: false,
|
||||
slideStyle: style,
|
||||
style,
|
||||
threshold: 100
|
||||
threshold: 100,
|
||||
className: "swipable-view",
|
||||
title: "Carousel",
|
||||
onTransitionEnd,
|
||||
axis: "x-reverse",
|
||||
springConfig
|
||||
});
|
||||
|
||||
React.createElement(SwipeableViews, {});
|
||||
|
||||
Reference in New Issue
Block a user