Giter Site home page Giter Site logo

react-native-visibility-aware-list's Introduction

react-native-visibility-aware-list

🛹visibility aware view that you can follow viewport

This React Native component, VisibilityAwareFlatList, is a custom implementation of the standard FlatList component. It is designed to provide awareness of the visibility of individual items within the list, allowing developers to respond to changes in the viewport.

Features

  • 60 FPS Performance: Designed to run smoothly at minimum 60 frames per second without any lag.
  • Visibility Tracking: Know exactly what items are visible within the viewport.
  • Customizable Thresholds: Set your own percentage threshold for triggering visibility changes.
  • Nested Viewport Support: Handle nested viewports easily with the context-based architecture.
  • Extendable: Can be used with your custom FlatList implementation.

Installation

yarn add react-native-visibility-aware-list

Usage

Here's a simple example to get you started:

import VisibilityAwareFlatList from 'react-native-visibility-aware-list';

// Usage in your component
<VisibilityAwareFlatList
  onViewportItemsChanged={(items) => console.log(items)}
  viewportItemsChangePercentage={0.5}
  // other FlatList props
/>

API

Props

  • onViewportItemsChanged(items: VisibleItem[]): Callback that gets called when the visible items change.
  • viewportItemsChangePercentage?: number: Minimum percentage of an item that must be visible to trigger onViewportItemsChanged.
  • triggerOnLayoutChange?: boolean: Trigger calculation on layout change.
  • nestedViewportKey?: string: Key for nested viewport.
  • as?: any: Custom component that will replace FlatList(must have cell renderer).

Methods

getCurrentVisibleItems(): VisibleItem[]: You can get current visible items via refs.

Contributing

This project is open-source and awaits your contributions. Feel free to make changes and send a pull request.

License

This project is licensed under the MIT license. For more details, see the LICENSE file.


README Created with ChatGPT

react-native-visibility-aware-list's People

Contributors

kubilaysalih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.