0.3.0 • Published 10 months ago

react-native-fast-scroll v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

react-native-fast-scroll

Fast Scroll implementation over Flashlist for react native

Show Case

Installation

yarn install react-native-fast-scroll

Requirements

  1. React Native Gesture Handler
  2. React Native Reanimated >= 2

Usage of the FastScroll Indicator

import { FastScrollIndicator } from 'react-native-fast-scroll';

// ...

const scrollToOffsetPercentage = (offsetPercentage: number) => {
    const flashListHeight =
      flashListRef.current?.recyclerlistview_unsafe?.getContentDimension()
        .height ?? 1;
    const offset = offsetPercentage * flashListHeight;
    flashListRef.current?.scrollToOffset({
      offset,
    });
}

const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
  const flashListHeight =
    flashListRef.current?.recyclerlistview_unsafe?.getContentDimension()
      .height ?? 1;
  const offsetPercentage =
    event.nativeEvent.contentOffset.y / flashListHeight;
  fastScrollIndicatorRef.current?.onScrollToOffsetPercentage(
    offsetPercentage
  );
  fastScrollSectionDotsRef.current?.onScrollToOffsetPercentage(
    offsetPercentage
  );
}


<FastScrollIndicator
    scrollToOffsetPercentage={scrollToOffsetPercentage}
    hideFastScrollIndicatorTimeout={2000}
    side={'right'}
    ref={fastScrollIndicatorRef}
    thumbColor={'rgba(65, 64, 66, 0.6)'}
    scrollBarColor={'transparent'}
/>

Usage of the FastScroll Section Tab

import { FastScrollSectionTab } from 'react-native-fast-scroll';

// ...

  const onScrollToIndex = (index: number) => {
    flashListRef.current?.scrollToIndex({
      index,
      animated: true,
    });
  };


<FastScrollSectionTab
    ref={fastScrollSectionTabRef}
    onScrollToIndex={onScrollToIndex}
    stickyHeaderIndicesWithData={stickyHeaderIndicesWithData}
/>

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

0.3.0

10 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago