Giter Site home page Giter Site logo

react-native-invertible-flatlist's Introduction

NOTICE: This package is now deprecated. As of React Native 0.47 the FlatList component supports inversion natively. Please use the native capabilities for future development.

InvertibleFlatList

An invertible FlatList for React Native.

This is the updated and renamed version of react-native-invertible-flat-list. That package is out of date and unmaintained. Please use this version going forward.

Installation

npm:

npm install --save react-native-invertible-flatlist

yarn:

yarn add react-native-invertible-flatlist

Import the component in your source as follows:

import { InvertibleFlatList } from 'react-native-invertible-flatlist';

Behavior

Behaves identically to the React Native FlatList component with the added functionality of being invertible. The classic example of this is a chat application where the most recent items are listed at the very bottom of a scrolling list that takes the user back in time. This works for both vertically scrolling and horizontally scrolling lists.

Usage

Minimal example:

<InvertibleFlatList
  inverted
  data={[{key: 'a'}, {key: 'b'}]}
  renderItem={({item}) => <Text>{item.key}</Text>}
/>

Props

FlatList props...

inverted?: ?boolean

Inverts the scrolling direction of the list.

Methods

FlatList methods...

Testing

If you want to test the implementation or just see a working example, this project comes with an example project out of the box. Once you clone, move into the test directory and run the following commands:

yarn install
yarn run ios

Development

The best way to do local development is to clone this project and install the package as a local dependency in your project. See the test project in this repository for an example of how to do this.

Known Issues

  • ListHeaderComponent and ListFooterComponent do not properly invert the content that is passed to them. This is because these properties can accept a React Component Class, a render function, or a rendered element. Because React Native now supports inversion natively, the amount of effort required to implement this properly doesn't equate with the convenience of these working perfectly. You'll need to apply the y-axis scale inversion to these components yourself before passing them to InvertibleFlatList.

react-native-invertible-flatlist's People

Watchers

James Cloos avatar tt rt 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.