UNPKG

@kirz/react-native-toolkit

Version:

Toolkit to speed up React Native development

78 lines 3.15 kB
import { FunctionComponent, ReactNode, Ref } from 'react'; import { FlatListProps, ImageProps, ImageSourcePropType } from 'react-native'; import { SharedValue } from 'react-native-reanimated'; import { TextProps } from './Text'; import { ViewProps } from './View'; export type FullscreenCarouselContext = { progress: SharedValue<number>; getActiveSlideIndex: () => number; slidesCount: number; }; export type FullscreenCarouselRef = { scrollTo: (index: number, animated?: boolean) => Promise<boolean>; scrollToPrev: (animated?: boolean) => Promise<boolean>; scrollToNext: (animated?: boolean) => Promise<boolean>; }; export type SlideLayoutSection<T> = ({ type: 'image'; valueGetter: (item: T, index: number) => ImageSourcePropType; renderItem?: (item: T, index: number) => ReactNode; imageProps?: ((item: T, index: number) => Partial<ImageProps>) | Partial<ImageProps>; imageContainerProps?: ((item: T, index: number) => ViewProps) | ViewProps; wrapperProps?: ((item: T, index: number) => ViewProps) | ViewProps; } | { type: 'text'; valueGetter: (item: T, index: number) => string; textProps?: ((item: T, index: number) => TextProps) | TextProps; wrapperProps?: ((item: T, index: number) => ViewProps) | ViewProps; } | { type: 'custom'; renderItem?: (item: T, index: number) => ReactNode; wrapperProps?: ((item: T, index: number) => ViewProps) | ViewProps; }) & { hidden?: (item: T, index: number) => boolean; }; export type StaticLayoutSection = ({ type: 'indicator'; component: FunctionComponent<FullscreenCarouselContext>; wrapperProps?: ViewProps; } | { type: 'custom'; renderItem: (context: FullscreenCarouselContext) => ReactNode; wrapperProps?: ViewProps; }) & { position: 'top' | 'slide' | 'bottom'; }; export declare const SelectedSlideIndexAtom: import("jotai").PrimitiveAtom<number> & { init: number; }; export type FullscreenCarouselProps<T extends Record<string, any> = Record<string, any>> = { controlRef?: Ref<FullscreenCarouselRef>; spacing?: number; edgeOffset?: number; progressValue?: SharedValue<number>; slides: T[]; slideLayout: { sections: SlideLayoutSection<T>[]; }; staticLayout: { sections: StaticLayoutSection[]; }; width?: number | 'auto' | 'screen'; controls?: { type: 'none' | 'buttons' | 'fullscreen'; buttonsOffset?: number; leftIcon?: ReactNode; rightIcon?: ReactNode; }; flatListProps?: Omit<FlatListProps<T>, 'data' | 'renderItem' | 'horizontal'>; autoplay?: { interval: number; delay?: number; resetDuration?: number; }; style?: FlatListProps<T>['style']; onSlideChanged?: (slideIndex: number) => void; }; export declare function FullscreenCarousel<T extends Record<string, any> = Record<string, any>>({ controlRef, slides, spacing, controls, progressValue, edgeOffset, autoplay, flatListProps, slideLayout, staticLayout, width: widthProp, onSlideChanged, ...props }: FullscreenCarouselProps<T>): JSX.Element; //# sourceMappingURL=FullscreenCarousel.d.ts.map