npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

facilitron-sortable-list

v1.0.4

Published

A performant, flicker-free sortable list component for React Native with drag-and-drop reordering

Readme

facilitron-sortable-list

⚠️ DEPRECATED: This package has been renamed to react-native-sortable-drag-list. Please update your dependencies to use the new package name.

A performant, flicker-free sortable list component for React Native with drag-and-drop reordering capabilities.

Features

  • 🚀 Flicker-free reordering - Smooth animations with no visual glitches
  • 📱 Native performance - Built with React Native Reanimated 2 and Gesture Handler
  • 🎯 Precise drag detection - Long press to activate, smooth gesture handling
  • 📍 Scroll position preservation - Maintains scroll position during reordering
  • 🔄 State persistence - Survives component remounts and updates
  • 🎨 Customizable rendering - Flexible item rendering with active state support
  • 📏 Configurable item height - Consistent item heights for optimal performance

Installation

⚠️ Please use the new package name:

yarn add react-native-sortable-drag-list
# or
npm install react-native-sortable-drag-list

Legacy package (deprecated):

yarn add facilitron-sortable-list
# or
npm install facilitron-sortable-list

Peer Dependencies

This library requires the following peer dependencies:

yarn add react-native-reanimated react-native-gesture-handler
# or
npm install react-native-reanimated react-native-gesture-handler

Usage

import React, { useState } from 'react';
import { View, Text } from 'react-native';
import { SortableList } from 'react-native-sortable-drag-list';

interface Item {
  id: string;
  title: string;
}

const MyComponent = () => {
  const [items, setItems] = useState<Item[]>([
    { id: '1', title: 'Item 1' },
    { id: '2', title: 'Item 2' },
    { id: '3', title: 'Item 3' },
  ]);

  const renderItem = ({
    item,
    isActive,
  }: {
    item: Item;
    isActive: boolean;
  }) => (
    <View style={[styles.item, isActive && styles.activeItem]}>
      <Text>{item.title}</Text>
    </View>
  );

  return (
    <SortableList
      data={items}
      keyExtractor={(item) => item.id}
      renderItem={renderItem}
      itemHeight={70} // Optional: customize item height
      onOrderChange={(newOrder) => {
        const reorderedItems = newOrder.map((index) => items[index]);
        setItems(reorderedItems);
      }}
    />
  );
};

API Reference

SortableList Props

| Prop | Type | Required | Description | | --------------- | -------------------------------------------------------- | -------- | --------------------------------- | | data | T[] | ✅ | Array of items to render | | keyExtractor | (item: T, index: number) => string | ✅ | Function to extract unique keys | | renderItem | (args: { item: T; isActive: boolean }) => ReactElement | ✅ | Function to render each item | | onDragEnd | () => void | ❌ | Callback when drag operation ends | | onOrderChange | (newOrder: number[]) => void | ❌ | Callback when order changes | | itemHeight | number | ❌ | Height of each item (default: 70) |

SortableItem Props

| Prop | Type | Required | Description | | ------------- | ---------------------------------------------------------- | -------- | --------------------------------- | | item | T | ✅ | The item data | | index | number | ✅ | Visual index in the list | | dataLength | number | ✅ | Total number of items | | renderItem | (params: { item: T; isActive: boolean }) => ReactElement | ✅ | Item renderer | | activeIndex | SharedValue<number> | ✅ | Currently active item index | | fromSlot | SharedValue<number> | ✅ | Starting position of dragged item | | targetSlot | SharedValue<number> | ✅ | Target position of dragged item | | onDragStart | () => void | ✅ | Drag start callback | | onDragEnd | (payload: { from: number; to: number }) => void | ✅ | Drag end callback |

Advanced Usage

Custom Item Height

// Pass custom item height directly to SortableList
<SortableList
  data={items}
  keyExtractor={(item) => item.id}
  renderItem={renderItem}
  itemHeight={100} // Custom height instead of default 70
  onOrderChange={(newOrder) => {
    const reorderedItems = newOrder.map((index) => items[index]);
    setItems(reorderedItems);
  }}
/>

Handling Scroll Position

const MyComponent = () => {
  const [items, setItems] = useState(/* ... */);

  return (
    <SortableList
      data={items}
      keyExtractor={(item) => item.id}
      renderItem={renderItem}
      onOrderChange={(newOrder) => {
        // The component automatically preserves scroll position
        // during reordering operations
        setItems(newOrder.map((index) => items[index]));
      }}
      onDragEnd={() => {
        // Optional: Perform actions when drag ends
        console.log('Drag operation completed');
      }}
    />
  );
};

Custom Item Rendering with Active State

import { View, Text } from 'react-native';
import Animated from 'react-native-reanimated';

const renderItem = ({ item, isActive }: { item: Item; isActive: boolean }) => (
  <Animated.View
    style={[
      styles.item,
      isActive && styles.activeItem,
      // Add custom animations based on isActive
    ]}
  >
    <Text style={styles.title}>{item.title}</Text>
    {isActive && <Text style={styles.draggingLabel}>Dragging...</Text>}
  </Animated.View>
);

Performance Features

  • Hardware acceleration - Uses renderToHardwareTextureAndroid for smooth animations
  • Offscreen compositing - Prevents visual artifacts during complex animations
  • Stable keys - Maintains React reconciliation efficiency
  • Shared values - Efficient state management with Reanimated
  • Gesture optimization - Minimal gesture detection overhead

Browser Support

This library is designed for React Native and does not support web browsers.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

1.0.0

  • Initial release
  • Flicker-free drag and drop reordering
  • Scroll position preservation
  • State persistence across remounts
  • Hardware acceleration support