Skip to content

Commit

Permalink
feat(react): add the missing render function type
Browse files Browse the repository at this point in the history
  • Loading branch information
yoychen committed May 8, 2021
1 parent c201408 commit cfa1459
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/swiper-react.d.ts
Expand Up @@ -27,6 +27,14 @@ interface Swiper extends SwiperOptions {
// MODULES_EVENTS
}

interface SlideData {
isActive: boolean;
isVisible: boolean;
isDuplicate: boolean;
isPrev: boolean;
isNext: boolean;
}

interface SwiperSlide {
/**
* Slide tag
Expand All @@ -48,6 +56,13 @@ interface SwiperSlide {
* @default false
*/
virtualIndex?: number;

/**
* Slide's child element or render function
*
* @default undefined
*/
children?: React.ReactNode | ((slideData: SlideData) => React.ReactNode);
}

interface Swiper
Expand All @@ -66,6 +81,6 @@ interface Swiper
interface SwiperSlide extends React.HTMLAttributes<HTMLElement> {}

declare const Swiper: React.FunctionComponent<Swiper>;
declare const SwiperSlide: React.FunctionComponent<SwiperSlide>;
declare const SwiperSlide: React.VoidFunctionComponent<SwiperSlide>;

export { Swiper, SwiperSlide };

0 comments on commit cfa1459

Please sign in to comment.