Gathering detailed insights and metrics for react-native-draggable-grid
Gathering detailed insights and metrics for react-native-draggable-grid
Gathering detailed insights and metrics for react-native-draggable-grid
Gathering detailed insights and metrics for react-native-draggable-grid
@devcesarlopes/react-native-draggable-grid
A draggable grid for react native
@th3rdwave/react-native-draggable-grid
A draggable grid for react native
react-native-draggable-masonry-grid
React native flatlist based implementation of masonary grid with drag/drop functionality
@rayx-io/react-native-draggable-grid
A draggable grid for react native
A draggable and sortable grid of react-native
npm install react-native-draggable-grid
Typescript
Module System
Node Version
NPM Version
55.4
Supply Chain
55.7
Quality
74.3
Maintenance
50
Vulnerability
94.1
License
TypeScript (98.42%)
JavaScript (1.58%)
Total Downloads
603,831
Last Day
168
Last Week
7,452
Last Month
31,846
Last Year
353,047
339 Stars
67 Commits
101 Forks
6 Watchers
22 Branches
8 Contributors
Updated on Jun 27, 2025
Latest Version
2.2.1
Package Id
react-native-draggable-grid@2.2.1
Unpacked Size
59.84 kB
Size
14.96 kB
File Count
21
NPM Version
8.3.1
Node Version
16.14.0
Published on
Mar 28, 2024
Cumulative downloads
Total Downloads
Last Day
-35.1%
168
Compared to previous day
Last Week
12.7%
7,452
Compared to previous week
Last Month
-9.3%
31,846
Compared to previous month
Last Year
252%
353,047
Compared to previous year
2
1npm install react-native-draggable-grid --save
1 2import React from 'react'; 3import { 4 View, 5 StyleSheet, 6 Text, 7} from 'react-native'; 8import { DraggableGrid } from 'react-native-draggable-grid'; 9 10interface MyTestProps { 11 12} 13 14interface MyTestState { 15 data:{key:string, name:string}[]; 16} 17 18export class MyTest extends React.Component<MyTestProps, MyTestState>{ 19 20 constructor(props:MyTestProps) { 21 super(props); 22 this.state = { 23 data:[ 24 {name:'1',key:'one'}, 25 {name:'2',key:'two'}, 26 {name:'3',key:'three'}, 27 {name:'4',key:'four'}, 28 {name:'5',key:'five'}, 29 {name:'6',key:'six'}, 30 {name:'7',key:'seven'}, 31 {name:'8',key:'eight'}, 32 {name:'9',key:'night'}, 33 {name:'0',key:'zero'}, 34 ], 35 }; 36 } 37 38 public render_item(item:{name:string, key:string}) { 39 return ( 40 <View 41 style={styles.item} 42 key={item.key} 43 > 44 <Text style={styles.item_text}>{item.name}</Text> 45 </View> 46 ); 47 } 48 49 render() { 50 return ( 51 <View style={styles.wrapper}> 52 <DraggableGrid 53 numColumns={4} 54 renderItem={this.render_item} 55 data={this.state.data} 56 onDragRelease={(data) => { 57 this.setState({data});// need reset the props data sort after drag release 58 }} 59 /> 60 </View> 61 ); 62 } 63} 64 65const styles = StyleSheet.create({ 66 button:{ 67 width:150, 68 height:100, 69 backgroundColor:'blue', 70 }, 71 wrapper:{ 72 paddingTop:100, 73 width:'100%', 74 height:'100%', 75 justifyContent:'center', 76 }, 77 item:{ 78 width:100, 79 height:100, 80 borderRadius:8, 81 backgroundColor:'red', 82 justifyContent:'center', 83 alignItems:'center', 84 }, 85 item_text:{ 86 fontSize:40, 87 color:'#FFFFFF', 88 }, 89}); 90 91
parameter | type | required | description |
---|---|---|---|
numColumns | number | yes | how many items should be render on one row |
data | array | yes | data's item must have unique key,item's render will depend on the key |
renderItem | (item, order:number) => ReactElement | yes | Takes an item from data and renders it into the list |
itemHeight | number | no | if not set this, it will the same as itemWidth |
dragStartAnimation | object | no | custom drag start animation |
style | object | no | grid styles |
parameter | type | required | description |
---|---|---|---|
onItemPress | (item) => void | no | Function will execute when item on press |
onDragStart | (startDragItem) => void | no | Function will execute when item start drag |
onDragRelease | (data) => void | no | Function will execute when item release, and will return the new ordered data |
onResetSort | (data) => void | no | Function will execute when dragged item change sort |
onDragging | (gestureState: PanResponderGestureState) => void | no | Function will execute when dragging item |
onDragItemActive | (item) => void | no | Function will execute when any item active |
parameter | type | required | description |
---|---|---|---|
disabledDrag | boolean | no | It will disable drag for the item |
disabledReSorted | boolean | no | It will disable resort the item |
if you set disabledResorted be true, it will look like that
If you want to use your custom animation, you can do like this
1 2 render() { 3 return ( 4 <View style={styles.wrapper}> 5 <DraggableGrid 6 numColumns={4} 7 renderItem={this.render_item} 8 data={this.state.data} 9 onDragStart={this.onDragStart} 10 dragStartAnimation={{ 11 transform:[ 12 {scale:this.state.animatedValue} 13 ], 14 }} 15 /> 16 </View> 17 ); 18 } 19 20 private onDragStart = () => { 21 this.state.animatedValue.setValue(1); 22 Animated.timing(this.state.animatedValue, { 23 toValue:3, 24 duration:400, 25 }).start(); 26 } 27
if you want resort item yourself,you only need change the data's sort, and the draggable-grid will auto resort by your data.
the data's key must unique
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 5/16 approved changesets -- score normalized to 3
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
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
license file not detected
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
70 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