1.1.1 • Published 5 years ago

@reactly/react-native-autoplay-scroll-video v1.1.1

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

react-native-autoplay-scroll-video

A SectionList component that identifies which item is in centre of the screen.

Installation

Installation can be done through npm or yarn:

npm i react-native-autoplay-scroll-video --save
yarn add react-native-autoplay-scroll-video

Example

Working Implementation as seen in GIF above - https://github.com/mikejcooper/React-Native-Autoplay-Infinity-Scroll

Usage

We extend the SectionList component adding two new props: the

  • focusWindow = The number of items above and below the centre that will be triggered in the callback.
  • renderItemWithInfo = Replaces normal 'renderItem' function. Introduces two booleans, itemInFocus & itemInFocusWindow.
import SectionListInFocus from '@reactly/react-native-autoplay-scroll-video'
<SectionListInFocus
    focusWindow={2}
    renderItemWithInfo={(item: VideoData, itemInFocus: boolean, itemInFocusWindow: boolean) => {
      return (
        <YourListItem
          playContent={itemInFocus}
          loadContent={itemInFocusWindow}
        />
      )
    }}
    {...YourSectionListProps}
/>

API

Props

All the SectionList props will be passed.

PropTypeDescription
renderItemWithInfoFunctionNew renderItem function
focusWindownumberItems above and below the centre that will receive itemInFocusWindow as true.

License

MIT.

Author

Mike Cooper