UNPKG

react-native-scroll-into-view

Version:

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

35 lines (34 loc) 1.7 kB
import React from 'react'; import { View, ScrollView } from 'react-native'; import { FullOptions, PartialOptions } from './config'; export declare const scrollIntoView: (scrollView: ScrollView, view: View, scrollY: number, options: PartialOptions) => Promise<void>; declare type GetScrollView = () => ScrollView; declare type GetScrollY = () => number; declare type GetDefaultOptions = () => FullOptions; export declare type ScrollIntoViewDependencies = { getScrollView: GetScrollView; getScrollY: GetScrollY; getDefaultOptions: GetDefaultOptions; }; export declare class ScrollIntoViewAPI { dependencies: ScrollIntoViewDependencies; constructor(dependencies: ScrollIntoViewDependencies); getNormalizedOptions: (options?: PartialOptions) => { insets: { top: number; bottom: number; } | { top: number; bottom: number; }; align: import("./config").Align; animated: boolean; immediate: boolean; computeScrollY: (scrollViewLayout: import("react-native").LayoutRectangle, viewLayout: import("react-native").LayoutRectangle, scrollY: number, insets: import("./config").Insets, align: import("./config").Align) => number; measureElement: (element: number | React.Component<any, any, any> | React.ComponentClass<any, any> | null) => Promise<import("react-native").LayoutRectangle>; }; scrollIntoView: (view: View, options?: Partial<FullOptions> | undefined) => Promise<void>; scrollIntoViewThrottled: (view: View, options: PartialOptions) => Promise<void>; scrollIntoViewImmediate: (view: View, options: PartialOptions) => Promise<void>; } export {};