Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-sortables

MatiPl01106.6kMIT1.7.0TypeScript support: included

Powerful Sortable Components for Flexible Content Reordering in React Native

draggable, draggable-flex, draggable-grid, flex, gesture-handler, gestures, grid, haptic-feedback, haptics, react-native, reanimated, reorder, sortable, sortable-flex, sortable-grid

readme

Banner

React Native Sortables

Powerful Sortable Components for Flexible Content Reordering in React Native

Documentation | Examples | Contributing

npm GitHub issues GitHub contributors GitHub Release Date GitHub

GitHub forks GitHub Repo stars GitHub watchers

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

  • 🎯 Flexible Layouts

    • Grid and Flex layout options
    • Support for items with different dimensions
  • 🚀 Performance & Reliability

  • Rich Interactions

    • Auto-scrolling beyond screen bounds
    • Customizable layout animations for items addition and removal
    • Built-in haptic feedback integration (requires react-native-haptic-feedback dependency)
    • Different reordering strategies (insertion, swapping)
  • 💡 Developer Experience

    • Simple API with powerful customization
    • Minimal setup required
  • More features

Installation

  • npm
npm install react-native-sortables
  • yarn
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.

Local Library Development

  1. Clone and setup:

    git clone https://github.com/MatiPl01/react-native-sortables.git
    cd react-native-sortables
    yarn
    yarn pod  # iOS only
  2. Start an example app:

    cd example/fabric  # or any other example
    yarn start

    Available example apps:

    • fabric - React Native Fabric example
    • paper - React Native Paper example
    • expo - Expo example
    • web - Web example

    You can also run commands from the project root using the yarn example:<name> <command> syntax, e.g.:

    yarn example:fabric start
    yarn example:paper android
    yarn example:expo ios
  3. Build and run:

    • iOS: yarn ios or build in Xcode
    • Android: yarn android or build in Android Studio

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)

changelog

1.7.0 (2025-05-26)

Bug Fixes

  • Invalid call to gesture manager when item is no longer available (#385) (5e5e1ca)
  • Invalid custom handle measurement (#384) (ad03d2b), closes #377
  • onPress not fired when activation delay is low (#377) (07065b5), closes #375
  • Order change callback invalid keyToIndex and shadow color interpolation (#380) (c0b3c03)
  • Stop passing excessive data to the item context (#383) (0b466ac)

Features

  • Active item dropped callback, more props in drag start callback (#381) (ef6e6cd)
  • Add keyToIndex and indexToKey to the item context (#379) (9166043)
  • Add more params to the item drop callback (#382) (36fe591)
  • Add more touch events to the touchable (#378) (c60500f)

1.6.0 (2025-04-27)

Bug Fixes

Features

  • Customizable dimensions animation type - layout and worklet (#355) (1d06c6f)
  • Item context and docs (#363) (ae212ba)

1.5.2 (2025-04-14)

Bug Fixes

1.5.1 (2025-04-01)

Bug Fixes

  • Remove react-native-builder-bob patch (#339) (32ae8c6)

1.5.0 (2025-03-31)

Bug Fixes

  • Active portal not working on Android (#330) (0edd622)
  • Data change example animated height conflicting with layout transition (#333) (d8f95bd)
  • Drag end callback invalid data array (#332) (e5fe29b)
  • fade drop indicator on snap (#323) (3178583)

Features

  • Add a possibility to enable or disable the portal provider (#331) (5526e29)
  • Delayed absolute layout initialization before sorting is enabled for the first time (#329) (57668f7)
  • onDragMove prop (#324) (98a9e9d)
  • Smart drag callbacks handling on UI or JS thread (#326) (f53f5d7)

1.4.0 (2025-03-23)

Bug Fixes

Features

1.3.2 (2025-03-05)

Bug Fixes

  • Add missing changes after deps upgrade, fix example app issues (#288) (f4ca42c)
  • Android crashes on gesture failure, horizontal scrollable issues (#294) (ef3e39f), closes #291

1.3.1 (2025-02-26)

Bug Fixes

  • Invalid fromIndex in onDragEnd callback (#284) (8ac4ea3)

1.3.0 (2025-02-26)

Bug Fixes

Features

  • Add horizontal direction support to the Sortable Grid (#277) (8706955)
  • Container overflow customization (#278) (fb6de0f)
  • Customizable reorder trigger origin (#274) (21a23ce)
  • Implement better grid reordering (#280) (c7e5daf)

1.2.1 (2025-02-19)

Bug Fixes

  • Don't skip entering and exiting animations on user's views, improve layout animations docs (#271) (464756a)
  • Items stacking issue (#273) (3fa07c6), closes #270 #272

1.2.0 (2025-02-17)

Bug Fixes

  • Flex layout flickering, lower drag fail offset (#258) (3d381a3)
  • Invalid item activation on iOS Fabric after container scroll (#266) (3ae207d)
  • Remaining web implementation issues (#247) (d48820b)
  • Sortable flex fragment children (#265) (4352be9), closes #36877
  • Sortable flex sizing in horizontal scrollable (#259) (468baeb), closes #257
  • Web flex layout and mobile drop animation issues (#250) (c2dc5aa)
  • Web sortables resizing and drop animation on web, change to absolute layout on Android (#267) (44d66db)

Features

  • Add a possibility to disable layout transition on item addition/removal (#262) (385b196), closes #36877
  • Custom drag handle, better drag gesture handling (#246) (0bbedff)
  • Expose layout transition prop (#256) (df109fa)
  • Horizontal auto scroll and horizontal parent scrollables support (#257) (538d99b), closes #244
  • OverDrag disabling per direction (#252) (c239fa3), closes #249
  • Possibility to disable container overflow by the dragged item (#249) (57cdab6)

1.1.1 (2025-02-05)

Bug Fixes

  • Animated sortable container height not working (#243) (d4034d6)

1.1.0 (2025-02-03)

Bug Fixes

  • A bunch of small issues I noticed (#225) (fe329bd)
  • Base web-example app issues (#217) (4d30f24)
  • Crash when haptic feedback is not installed in expo managed app (#231) (fd39c71), closes #227
  • Invalid layout on web when visibility of sortable changes (#235) (fdd750b)
  • Major implementation issues (#234) (fdb8cbd)
  • View drop animation on native after adding shouldAnimateLayout (#237) (3b78f83)

Features

  • Add missing sortEnabled props in docs, allow to pass shared value (#222) (d5b3380), closes #220
  • Make drag activation timings and drop animation duration customizable (#226) (dac417e)
  • Web example app (#214) (1fd05d3)

1.0.0 (2025-01-29)

Bug Fixes

  • Absolute flex layout (also reverse) calculation issues, restore paddings support (#185) (8b120b3)
  • Animation of items added to the sortable component (#200) (aa8e21c), closes #196
  • Auto scroll infinite updates issue (#111) (91b90c2)
  • Auto scroll not working when item is not dragged (#56) (6375847)
  • Circular dependencies (#178) (767ddb0)
  • Column flex layout, add layout example screen (#180) (dd321c6)
  • Don't trigger press animation when sorting is disabled (#168) (b6737d0)
  • Drop indicator dimensions and position (#97) (d86b4e1), closes #82
  • Example app screen flickering caused by safe area (#25) (371aef5)
  • eslint: Fix eslint config by downgrading to v8 (#3) (ad1f2ac)
  • Fix flex ordering for flex with alignment, prepare for release (#206) (e83e53a)
  • Incorrect auto scroll bounds when container measurements were outdated (#173) (2e4edca)
  • Initial render flickering and content overflow (#89) (b6f0e1f)
  • Item overlapping issue (#76) (9483b79)
  • Item removal and grid layout calculation (#161) (a1cbcd9)
  • Package path in the release workflow (#207) (6cf7e0c)
  • Pan gesture being beginning but not being activated on iOS (#114) (a932cc8)
  • Reanimated iOS and Android crashes by bumping version (#99) (5b4b2bd)
  • Release workflow working directory (#208) (09660d3)
  • Require cycle (#75) (388bfc3)
  • Reverse flex ordering and flex debug box (#203) (e2012ac)
  • Semantic release setup (#67) (3eb70df)
  • Set npm registry in publishConfig (#210) (5f77a6a)
  • Smaller and bigger issues (#176) (85c01f4)
  • SortableFlex items overflowing parent container (#123) (d37092b)
  • Transition from relative to absolute flex layout (#150) (3740542)
  • Unmounted view measurements on the UI thread showing warnings (#110) (d21dabc)

Features

  • Absolute flex layout items positioning (#8) (c8affc6)
  • Active item decoration (#13) (6b1f325)
  • Active item drop indicator (#48) (6da6295)
  • Active item snapping to finger (#79) (2fa839d)
  • Add callback functions called on drag state or order changes (#70) (4605697)
  • Add drag context provider (#10) (134e727)
  • Add drop indicator examples in the example app (#96) (a260acc)
  • Add grid items spacing via rowGap and columnGap (#82) (120e66b)
  • Add item context, add working touchable (#121) (cf35be0)
  • Add optional haptic feedback via react-native-haptic-feedback (#69) (072283d)
  • Allow animated props to be passed to components (#42) (a8b6e7e)
  • Animated container height (#162) (42eff3c)
  • Animated container height changes and column dimensions change (#83) (88190c4)
  • Auto scroll provider (#45) (c6ff65d)
  • Basic SortableView and MeasurementsProvider implementation (#2) (af06231)
  • Clean up draggable view implementation, add decoration component (#60) (edc04f8)
  • Data change examples (#115) (b55622d)
  • Debug helper components for layout debugging (#127) (f829fa4)
  • Debug provider (#132) (9f91a6a)
  • FlatList auto scroll example (#46) (20e6b4b)
  • Flex items reordering (#15) (7421d03)
  • Flex layout provider (#6) (16be3f8)
  • Flex order updater reimplementation (#165) (02ee7e0)
  • Grid items reordering (#14) (f8b8ea8)
  • Grid layout provider (#5) (8890c7c)
  • Implement debug examples (#135) (c8354fb)
  • Item layout animations (#151) (347abfe)
  • Migrate example to the new architecture, add flash-list example (#55) (92238e3)
  • Navigation state persistence and example styles enhancements (#107) (c2984b0)
  • Refine grid swap ordering strategy (#167) (7552470)
  • Sortable flex auto scroll examples (#100) (118b359)
  • Sortable grid base component that displays items in a grid (#4) (b058cc7)
  • SortableGrid auto scroll examples (#106) (26707a5)
  • Start working on customizable sort strategy (#166) (726a87c)
  • Support item count change in state in reaction to order change (#116) (3aeffd7)
  • Use layout animations for sortable items position updates (#172) (fce8e15)