
Overview
React Native Sortables is a powerful and easy-to-use library that brings smooth, intuitive content reordering to React Native. It provides specialized components whose children can be dynamically reordered through natural dragging gestures.
Key Features
Installation
npm install react-native-sortables
yarn add react-native-sortables
Dependencies
This library is built with:
Make sure to follow their installation instructions for your project.
Quick Start
import { useCallback } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import type { SortableGridRenderItem } from 'react-native-sortables';
import Sortable from 'react-native-sortables';
const DATA = Array.from({ length: 12 }, (_, index) => `Item ${index + 1}`);
export default function Grid() {
const renderItem = useCallback<SortableGridRenderItem<string>>(
({ item }) => (
<View style={styles.card}>
<Text>{item}</Text>
</View>
),
[]
);
return (
<Sortable.Grid
columns={3}
data={DATA}
renderItem={renderItem}
rowGap={10}
columnGap={10}
/>
);
}
const styles = StyleSheet.create({
card: {
backgroundColor: '#36877F',
height: 100,
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center'
}
});
For detailed usage and examples, check out the Documentation.
Contributing
Contributions are welcome! Please read the Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
(back to top)