react-native-use-in-view
Version:
A versatile and efficient React Native component designed for seamless integration of scroll-based features into mobile applications. This package offers a powerful ScrollView observer that allows developers to easily track and respond to scroll events an
24 lines • 1.41 kB
TypeScript
import React from 'react';
import { ScrollView, View } from 'react-native';
import type { IFlatListObserverProps, IScrollViewObserverProps, IUseInViewOptions } from './ScrollViewObserver.types';
/**
* Hook to detect if an element is in the viewport.
* The `ref` must be attached to a native component (e.g., View, Text) or a custom component that forwards the ref to a native component.
*/
export declare const useInView: (options?: IUseInViewOptions) => {
ref: React.RefObject<View>;
inView: boolean;
};
/**
* Implementation of a ScrollView with in-view detection and scroll listeners.
* This component is used to wrap a ScrollView and provide in-view detection for its children.
* It takes all the props of a standard ScrollView and forwards the ref to the internal ScrollView.
*/
export declare const ScrollViewObserver: React.ForwardRefExoticComponent<IScrollViewObserverProps & React.RefAttributes<ScrollView>>;
/**
* Implementation of a FlatList with in-view detection and scroll listeners.
* This component is used to wrap a FlatList and provide in-view detection for its children.
* It takes all the props of a standard FlatList and forwards the ref to the internal FlatList.
*/
export declare const FlatListObserver: <K = any>({ scrollEventThrottle, flatListRef, onLayout, onScroll, ...rest }: IFlatListObserverProps<K>) => React.JSX.Element;
//# sourceMappingURL=index.d.ts.map