UNPKG

react-native-scroll-into-view

Version:

React-Native port of DOMElement.scrollIntoView() web function, for ScrollView

62 lines (61 loc) 1.91 kB
import { ScrollView } from 'react-native'; import { measureElement } from './utils'; import { computeScrollY } from './computeScrollY'; export declare type Insets = { top: number; bottom: number; }; export declare type Align = 'auto' | 'top' | 'bottom' | 'center'; export declare type FullOptions = { align: Align; animated: boolean; immediate: boolean; insets: Insets; computeScrollY: typeof computeScrollY; measureElement: typeof measureElement; }; export declare type PartialOptions = Partial<FullOptions>; export declare const DefaultOptions: FullOptions; export declare type OptionKey = keyof FullOptions; export declare const OptionKeys: OptionKey[]; export declare const normalizeOptions: (options?: PartialOptions, fallbackOptions?: FullOptions) => { insets: { top: number; bottom: number; } | { top: number; bottom: number; }; align: Align; animated: boolean; immediate: boolean; computeScrollY: typeof computeScrollY; measureElement: typeof measureElement; }; export declare type FullHOCConfig = { refPropName: string; getScrollViewNode: (scrollView: ScrollView) => ScrollView; scrollEventThrottle: 16; options: PartialOptions; }; export declare type PartialHOCConfig = Partial<FullHOCConfig>; export declare const DefaultHOCConfig: FullHOCConfig; export declare const normalizeHOCConfig: (config?: PartialHOCConfig) => { options: { insets: { top: number; bottom: number; } | { top: number; bottom: number; }; align: Align; animated: boolean; immediate: boolean; computeScrollY: typeof computeScrollY; measureElement: typeof measureElement; }; refPropName: string; getScrollViewNode: (scrollView: ScrollView) => ScrollView; scrollEventThrottle: 16; };