minhtranite / react-photoswipe

PhotoSwipe, PhotoSwipeGallery component for ReactJS base on PhotoSwipe.
322 stars 106 forks source link

Typescript Typings #43

Open michelalbers opened 5 years ago

michelalbers commented 5 years ago

It would be nice to have typescript typings for this. I wrote a first version of them here:

declare module 'react-photoswipe' {
  import * as React from 'react';
  export interface PhotoSwipeGalleryItem {
    src: string;
    thumbnail: string;
    w: number;
    h: number;
    title: string;
  }

  export interface PhotoSwipeProps {
    afterChange?: () => void;
    beforeChange?: () => void;
    className?: string;
    close?: () => void;
    destroy?: () => void;
    gettingData?: () => void;
    id?: string;
    imageLoadComplete?: () => void;
    initialZoomIn?: () => void;
    initialZoomInEnd?: () => void;
    initialZoomOut?: () => void;
    initialZoomOutEnd?: () => void;
    isOpen: boolean;
    items: PhotoSwipeGalleryItem[];
    mouseUsed?: () => void;
    onClose?: () => void;
    options?: any;
    parseVerticalMargin?: () => void;
    preventDragEvent?: () => void;
    resize?: () => void;
    shareLinkClick?: () => void;
    unbindEvents?: () => void;
    updateScrollOffset?: () => void;
  }

  export interface PhotoSwipeGalleryProps extends PhotoSwipeProps {
    thumbnailContent: (PhotoSwipeGalleryItem) => React.ReactNode;
  }

  export class PhotoSwipe extends React.Component<PhotoSwipeProps> { render(): JSX.Element; }
  export class PhotoSwipeGallery extends React.Component<PhotoSwipeGalleryProps> { render(): JSX.Element; }
}

Should we release them here oder in the @typings repo?

kringt06 commented 5 years ago

support

andyfangaf commented 5 years ago

👍