Napoleonic Political Magnificence
Miss any of our Open RFC calls?Watch the recordings here! »

react-native-draggable-animation-list

1.1.1 • Public • Published

React native draggable animation list

import  React, { Component } from  'react';
import { StyleSheet, Text, View, TouchableOpacity } from  'react-native';
import DragAndDropAnimation from 'react-native-draggable-animation-list';
  
  
export  default  class  App  extends  Component {
 
    state  = {
        orderList: [0, 1, 2, 3, 4, 5],
        data: ['List 1', 'List 2', 'List 3', 'List 4', 'List 5', 'List 6'],
    }
 
    render() {
        const { orderList, data } =  this.state;
 
        return (
            <View  style={styles.container}>
                <DragAndDropAnimation
                    orderList={  orderList  }
                    onOrderListChanged={(newOrderList) => {
                        this.setState({
                            orderList: [...newOrderList],
                        });
                    }}
                    onDraggableItemStart={(itemIndex) => {
 
             }}
                    onDraggableItemRelease={(itemNextIndex) => {
 
                    }}
                    delayLongPress={ 200 } // Start dragging after x milliseconds
                    renderItem={(itemKey, itemIndex) => {
                        return (
                            <Text>
                                {  data[itemKey] }
                            </Text>
                        );
                    }}
                />
            </View>
        );
    }
 
}

Install

npm i react-native-draggable-animation-list

DownloadsWeekly Downloads

7

Version

1.1.1

License

ISC

Unpacked Size

248 kB

Total Files

53

Last publish

Collaborators

  • avatar