Registry / testing / react-native-draggable-flatlist

react-native-draggable-flatlist

JSON →
library4.0.3jsnpmunverified

A drag-and-drop-enabled FlatList component for React Native, version 4.0.3. Fully native interactions powered by Reanimated (>=2.8.0) and React Native Gesture Handler (>=2.0.0). Requires react-native >=0.64.0. Differentiators: smooth animations, supports swipeable items via companion library, and TypeScript type definitions included. Actively maintained on GitHub.

npm install react-native-draggable-flatlist
INSTALL
IMPORT
SIG · REACT-NATIVE-DRAGG
R
react-native-draggable-flatlist
testingjavascriptv4.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DraggableFlatList
import DraggableFlatList from 'react-native-draggable-flatlist'
const DraggableFlatList = require('react-native-draggable-flatlist');
Default export; named export also available as { DraggableFlatList }.
RenderItemParams
import { RenderItemParams } from 'react-native-draggable-flatlist'
import { RenderItemParams } from 'react-native-draggable-flatlist'
TypeScript type for renderItem parameters.
ScaleDecorator
import { ScaleDecorator } from 'react-native-draggable-flatlist'
Optional decorator for scaling animation.
ShadowDecorator
import { ShadowDecorator } from 'react-native-draggable-flatlist'
Optional decorator for shadow animation.
OpacityDecorator
import { OpacityDecorator } from 'react-native-draggable-flatlist'
Optional decorator for opacity animation.
NestableDraggableFlatList
import { NestableDraggableFlatList } from 'react-native-draggable-flatlist'
For nested drag-and-drop lists.

Basic usage: long press to drag, reorder items, and update state on drag end.

import React, { useState } from 'react'; import { Text, TouchableOpacity } from 'react-native'; import DraggableFlatList, { RenderItemParams } from 'react-native-draggable-flatlist'; const App: React.FC = () => { const [data, setData] = useState([ { key: '1', label: 'Item 1' }, { key: '2', label: 'Item 2' }, { key: '3', label: 'Item 3' }, ]); const renderItem = ({ item, drag, isActive }: RenderItemParams<{ key: string; label: string }>) => ( <TouchableOpacity onLongPress={drag} style={{ padding: 20, backgroundColor: isActive ? 'lightblue' : 'white', marginVertical: 2, }} > <Text>{item.label}</Text> </TouchableOpacity> ); return ( <DraggableFlatList data={data} renderItem={renderItem} keyExtractor={(item) => item.key} onDragEnd={({ data }) => setData(data)} /> ); }; export default App;
Debug
Known issues
gotchakeyExtractor is required for stable reordering.
fix
Always provide a unique keyExtractor that returns a string.
affects: >=4.0.0
gotchaRequires react-native-gesture-handler and react-native-reanimated to be installed and configured correctly (including Babel plugin for Reanimated).
fix
Follow the installation guides: add GestureHandlerRootView, configure babel.config.js with reanimated/plugin.
affects: >=4.0.0
breakingVersion 4.0.0 changed the export to default export; named export DraggableFlatList still available as named.
fix
Use import DraggableFlatList from 'react-native-draggable-flatlist' or import { DraggableFlatList } from 'react-native-draggable-flatlist'.
affects: >=4.0.0
deprecatedThe renderPlaceholder prop may be removed in future versions.
fix
Use renderItem with isActive to show placeholder or use decorators.
affects: >=4.0.0
gotchaAndroid requires additional setup for Gesture Handler: wrap root with GestureHandlerRootView.
fix
In App.tsx, import GestureHandlerRootView from react-native-gesture-handler and wrap your app.
affects: >=4.0.0
Errors
Common errors & fixes
TypeError: undefined is not an object (evaluating '_this.onGestureEvent')
Missing Gesture Handler setup or incorrect version.
fix
Ensure react-native-gesture-handler >=2.0.0 is installed and GestureHandlerRootView wraps the component tree.
Error: [Reanimated] Reanimated 2 failed to create a worklet, maybe you forgot to add reanimated's babel plugin?
Reanimated babel plugin not configured.
fix
Add 'react-native-reanimated/plugin' to your babel.config.js plugins array.
Invariant Violation: NativeComponent: "RNCDraggableFlatList" was not found in the UIManager.
Native module not linked or pod not installed.
fix
Run npx pod-install for iOS, or rebuild the Android app.
Cannot read property 'scrollToOffset' of undefined
Ref forwarding to FlatList not set up correctly.
fix
Pass ref prop to DraggableFlatList, not to the underlying FlatList.
Upgrade
Version history
4.0.3latest on npm
Audit
Dependencies
react-nativerequiredpeer dependency required for FlatList and core
react-native-gesture-handlerrequiredpeer dependency for gesture handling
react-native-reanimatedrequiredpeer dependency for animated interactions
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
react-native-draggable-flatlist — npm install react-native-draggable-flatlist · libregistry