1.1.1 • Published 5 years ago

react-native-draggable-animation-list v1.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

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>
		);
	}

}