diff --git a/index.d.ts b/index.d.ts index 075ae3dc..baa1e075 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,69 +1,83 @@ -declare module 'rn-viewpager' { +declare module "rn-viewpager" { + import * as React from "react"; + import { + ImageURISource, + ViewProperties, + NativeScrollEvent, + NativeSyntheticEvent, + ViewPagerAndroidOnPageScrollEventData, + ScrollViewProperties + } from "react-native"; - import * as React from 'react'; - import { ImageURISource, ViewProperties, NativeScrollEvent, NativeSyntheticEvent, ViewPagerAndroidOnPageScrollEventData } from 'react-native'; - - interface ViewPagerProps extends ViewProperties { - initialPage?: number; - keyboardDismissMode?: 'none' | 'on-drag'; - onPageScroll?(e: ViewPagerAndroidOnPageScrollEventData): void; - onPageScrollStateChanged?(state: 'idle' | 'settling' | 'dragging'): void; - onPageSelected?(e: ViewPagerAndroidOnPageScrollEventData): void; - scrollEnabled?: boolean; - } - - export class ViewPager extends React.Component { - setPage(selectedPage: number): void; - setPageWithoutAnimation(selectedPage: number): void; - } - - interface IndicatorViewPagerProps extends ViewProperties { - indicator: React.ReactNode; - pagerStyle?: ViewProperties['style']; - autoPlayEnable?: boolean; - autoPlayInterval?: boolean; - horizontalScroll?: boolean; + interface ViewPagerProps extends ScrollViewProperties { + initialPage?: number; + keyboardDismissMode?: "none" | "on-drag"; + onPageScroll?(e: ViewPagerAndroidOnPageScrollEventData): void; + onPageScrollStateChanged?(state: "idle" | "settling" | "dragging"): void; + onPageSelected?(e: ViewPagerAndroidOnPageScrollEventData): void; + scrollEnabled?: boolean; + horizontalScroll?: boolean; + } - } - export class IndicatorViewPager extends React.Component { - setPage(selectedPage: number): void; - setPageWithoutAnimation(selectedPage: number): void; - } + export class ViewPager extends React.Component { + setPage(selectedPage: number): void; + setPageWithoutAnimation(selectedPage: number): void; + } - interface PagerDotIndicatorProps extends ViewProperties { - pageCount: number; - dotStyle?: ViewProperties['style']; - selectedDotStyle?: ViewProperties['style']; - hideSingle?: boolean; - } + interface IndicatorViewPagerProps extends ViewProperties { + indicator: React.ReactNode; + pagerStyle?: ViewProperties["style"]; + autoPlayEnable?: boolean; + autoPlayInterval?: boolean; + horizontalScroll?: boolean; + } + export class IndicatorViewPager extends React.Component< + IndicatorViewPagerProps + > { + setPage(selectedPage: number): void; + setPageWithoutAnimation(selectedPage: number): void; + } - export class PagerDotIndicator extends React.Component {} + interface PagerDotIndicatorProps extends ViewProperties { + pageCount: number; + dotStyle?: ViewProperties["style"]; + selectedDotStyle?: ViewProperties["style"]; + hideSingle?: boolean; + } - interface PageTitleIndicatorProps extends ViewProperties { - titles: string[]; - trackScroll?: boolean; - itemStyle?: ViewProperties['style']; - itemTextStyle?: ViewProperties['style']; - selectedItemTextStyle?: ViewProperties['style']; - selectedBorderStyle?: ViewProperties['style']; - renderTitle(index: number, title: string, isSelected: boolean): JSX.Element; - } - export class PagerTitleIndicator extends React.Component {} + export class PagerDotIndicator extends React.Component< + PagerDotIndicatorProps + > {} - interface PagerTabIndicatorProps extends ViewProperties { - tabs: Array<{ - text: string, - iconSource: ImageURISource, - selectedIconSource: ImageURISource - }>; - itemStyle?: ViewProperties['style']; - selectedItemStyle?: ViewProperties['style']; - iconStyle?: ViewProperties['style']; - selectedIconStyle?: ViewProperties['style']; - textStyle?: ViewProperties['style']; - selectedTextStyle?: ViewProperties['style']; - changePageWithAnimation?: boolean; - } + interface PageTitleIndicatorProps extends ViewProperties { + titles: string[]; + trackScroll?: boolean; + itemStyle?: ViewProperties["style"]; + itemTextStyle?: ViewProperties["style"]; + selectedItemTextStyle?: ViewProperties["style"]; + selectedBorderStyle?: ViewProperties["style"]; + renderTitle(index: number, title: string, isSelected: boolean): JSX.Element; + } + export class PagerTitleIndicator extends React.Component< + PageTitleIndicatorProps + > {} - export class PagerTabIndicator extends React.PureComponent {} + interface PagerTabIndicatorProps extends ViewProperties { + tabs: Array<{ + text: string; + iconSource: ImageURISource; + selectedIconSource: ImageURISource; + }>; + itemStyle?: ViewProperties["style"]; + selectedItemStyle?: ViewProperties["style"]; + iconStyle?: ViewProperties["style"]; + selectedIconStyle?: ViewProperties["style"]; + textStyle?: ViewProperties["style"]; + selectedTextStyle?: ViewProperties["style"]; + changePageWithAnimation?: boolean; } + + export class PagerTabIndicator extends React.PureComponent< + PagerTabIndicatorProps + > {} +}