Skip to content

Hao-yiwen/react-native-overscroll2

Repository files navigation

react-native-overscroll2

Supports Android, iOS

A android scrollView decorator for support bounce.

Explanation

This library is forked from react-native-overscroll. Because this library has not been updated for a long time, update the library implementation and add event callbacks.

This library support old arch and new arch.

Installation

yarn add react-native-overscroll2

Usage

import { FlatList } from 'react-native';
import { OverscrollView } from 'react-native-overscroll2';

const data = Array.from({ length: 20 }, (_, i) => `Item ${i + 1}`);

<OverscrollView
  bounce={true}
  onOverscroll={(event) => {
    console.log(
      'onOverscroll',
      event.nativeEvent.state,
      event.nativeEvent.offset
    );
  }}
>
  <FlatList
    data={data}
    keyExtractor={(_item, index) => index.toString()}
    renderItem={renderItem}
    overScrollMode="always"
  />
</OverscrollView>;

License

MIT