Gathering detailed insights and metrics for react-native-draggable-flatlist
Gathering detailed insights and metrics for react-native-draggable-flatlist
Gathering detailed insights and metrics for react-native-draggable-flatlist
Gathering detailed insights and metrics for react-native-draggable-flatlist
@upacyxou/react-native-draggable-flatlist
A drag-and-drop-enabled FlatList component for React Native
@shaquillehinds/react-native-draggable-flatlist
Simple wapper wapper around react native's flatlist that allows draggable items
@types/react-native-draggable-flatlist
Stub TypeScript definitions entry for react-native-draggable-flatlist, which provides its own types definitions
@tuya-oh/react-native-draggable-flatlist
A drag-and-drop-enabled FlatList component for React Native
A drag-and-drop-enabled FlatList for React Native
npm install react-native-draggable-flatlist
Typescript
Module System
Node Version
NPM Version
TypeScript (96.58%)
JavaScript (3.42%)
Total Downloads
13,667,594
Last Day
7,371
Last Week
176,432
Last Month
689,475
Last Year
5,977,062
MIT License
2,076 Stars
379 Commits
435 Forks
9 Watchers
10 Branches
33 Contributors
Updated on Jun 30, 2025
Minified
Minified + Gzipped
Latest Version
4.0.3
Package Id
react-native-draggable-flatlist@4.0.3
Unpacked Size
510.85 kB
Size
102.79 kB
File Count
149
NPM Version
9.8.1
Node Version
18.18.0
Published on
May 06, 2025
Cumulative downloads
Total Downloads
Last Day
72.8%
7,371
Compared to previous day
Last Week
11.2%
176,432
Compared to previous week
Last Month
-11.4%
689,475
Compared to previous month
Last Year
99.2%
5,977,062
Compared to previous year
1
3
A drag-and-drop-enabled FlatList component for React Native.
Fully native interactions powered by Reanimated and React Native Gesture Handler.
To use swipeable list items in a DraggableFlatList see React Native Swipeable Item.
MainActivity.java
. Be sure to follow all Android instructions!npm
or yarn
with npm
:
npm install --save react-native-draggable-flatlist
with yarn
:
yarn add react-native-draggable-flatlist
import DraggableFlatList from 'react-native-draggable-flatlist'
All props are spread onto underlying FlatList
Name | Type | Description |
---|---|---|
data | T[] | Items to be rendered. |
ref | React.RefObject<FlatList<T>> | FlatList ref to be forwarded to the underlying FlatList. |
renderItem | (params: { item: T, getIndex: () => number | undefined, drag: () => void, isActive: boolean}) => JSX.Element | Call drag when the row should become active (i.e. in an onLongPress or onPressIn ). |
renderPlaceholder | (params: { item: T, index: number }) => React.ReactNode | Component to be rendered underneath the hovering component |
keyExtractor | (item: T, index: number) => string | Unique key for each item (required) |
onDragBegin | (index: number) => void | Called when row becomes active. |
onRelease | (index: number) => void | Called when active row touch ends. |
onDragEnd | (params: { data: T[], from: number, to: number }) => void | Called after animation has completed. Returns updated ordering of data |
autoscrollThreshold | number | Distance from edge of container where list begins to autoscroll when dragging. |
autoscrollSpeed | number | Determines how fast the list autoscrolls. |
animationConfig | Partial<WithSpringConfig> | Configure list animations. See reanimated spring config |
activationDistance | number | Distance a finger must travel before the gesture handler activates. Useful when using a draggable list within a TabNavigator so that the list does not capture navigator gestures. |
onScrollOffsetChange | (offset: number) => void | Called with scroll offset. Stand-in for onScroll . |
onPlaceholderIndexChange | (index: number) => void | Called when the index of the placeholder changes |
dragItemOverflow | boolean | If true, dragged item follows finger beyond list boundary. |
dragHitSlop | object: {top: number, left: number, bottom: number, right: number} | Enables control over what part of the connected view area can be used to begin recognizing the gesture. Numbers need to be non-positive (only possible to reduce responsive area). |
debug | boolean | Enables debug logging and animation debugger. |
containerStyle | StyleProp<ViewStyle> | Style of the main component. |
simultaneousHandlers | React.Ref<any> or React.Ref<any>[] | References to other gesture handlers, mainly useful when using this component within a ScrollView . See Cross handler interactions. |
itemEnteringAnimation | Reanimated AnimationBuilder (docs) | Animation when item is added to list. |
itemExitingAnimation | Reanimated AnimationBuilder (docs) | Animation when item is removed from list. |
itemLayoutAnimation | Reanimated AnimationBuilder (docs) | Animation when list items change position (enableLayoutAnimationExperimental prop must be true ). |
enableLayoutAnimationExperimental | boolean | Flag to turn on experimental support for itemLayoutAnimation . |
Cell Decorators are an easy way to add common hover animations. For example, wrapping renderItem
in the <ScaleDecorator>
component will automatically scale up the active item while hovering (see example below).
ScaleDecorator
, ShadowDecorator
, and OpacityDecorator
are currently exported. Developers may create their own custom decorators using the animated values provided by the useOnCellActiveAnimation
hook.
It's possible to render multiple DraggableFlatList
components within a single scrollable parent by wrapping one or more NestableDraggableFlatList
components within an outer NestableScrollContainer
component.
NestableScrollContainer
extends the ScrollView
from react-native-gesture-handler
, and NestableDraggableFlatList
extends DraggableFlatList
, so all available props may be passed into both of them.
Note: When using NestableDraggableFlatLists, all React Native warnings about nested list performance will be disabled.
1import { NestableScrollContainer, NestableDraggableFlatList } from "react-native-draggable-flatlist" 2 3... 4 5 const [data1, setData1] = useState(initialData1); 6 const [data2, setData2] = useState(initialData2); 7 const [data3, setData3] = useState(initialData3); 8 9 return ( 10 <NestableScrollContainer> 11 <Header text='List 1' /> 12 <NestableDraggableFlatList 13 data={data1} 14 renderItem={renderItem} 15 keyExtractor={keyExtractor} 16 onDragEnd={({ data }) => setData1(data)} 17 /> 18 <Header text='List 2' /> 19 <NestableDraggableFlatList 20 data={data2} 21 renderItem={renderItem} 22 keyExtractor={keyExtractor} 23 onDragEnd={({ data }) => setData2(data)} 24 /> 25 <Header text='List 3' /> 26 <NestableDraggableFlatList 27 data={data3} 28 renderItem={renderItem} 29 keyExtractor={keyExtractor} 30 onDragEnd={({ data }) => setData3(data)} 31 /> 32 </NestableScrollContainer> 33 )
Example snack: https://snack.expo.dev/@computerjazz/draggable-flatlist-examples
1import React, { useState } from "react"; 2import { Text, View, StyleSheet, TouchableOpacity } from "react-native"; 3import DraggableFlatList, { 4 ScaleDecorator, 5} from "react-native-draggable-flatlist"; 6 7const NUM_ITEMS = 10; 8function getColor(i: number) { 9 const multiplier = 255 / (NUM_ITEMS - 1); 10 const colorVal = i * multiplier; 11 return `rgb(${colorVal}, ${Math.abs(128 - colorVal)}, ${255 - colorVal})`; 12} 13 14type Item = { 15 key: string; 16 label: string; 17 height: number; 18 width: number; 19 backgroundColor: string; 20}; 21 22const initialData: Item[] = [...Array(NUM_ITEMS)].map((d, index) => { 23 const backgroundColor = getColor(index); 24 return { 25 key: `item-${index}`, 26 label: String(index) + "", 27 height: 100, 28 width: 60 + Math.random() * 40, 29 backgroundColor, 30 }; 31}); 32 33export default function App() { 34 const [data, setData] = useState(initialData); 35 36 const renderItem = ({ item, drag, isActive }: RenderItemParams<Item>) => { 37 return ( 38 <ScaleDecorator> 39 <TouchableOpacity 40 onLongPress={drag} 41 disabled={isActive} 42 style={[ 43 styles.rowItem, 44 { backgroundColor: isActive ? "red" : item.backgroundColor }, 45 ]} 46 > 47 <Text style={styles.text}>{item.label}</Text> 48 </TouchableOpacity> 49 </ScaleDecorator> 50 ); 51 }; 52 53 return ( 54 <DraggableFlatList 55 data={data} 56 onDragEnd={({ data }) => setData(data)} 57 keyExtractor={(item) => item.key} 58 renderItem={renderItem} 59 /> 60 ); 61} 62 63const styles = StyleSheet.create({ 64 rowItem: { 65 height: 100, 66 width: 100, 67 alignItems: "center", 68 justifyContent: "center", 69 }, 70 text: { 71 color: "white", 72 fontSize: 24, 73 fontWeight: "bold", 74 textAlign: "center", 75 }, 76});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
Found 7/18 approved changesets -- score normalized to 3
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More