Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/flash-list

Package Overview
Dependencies
Maintainers
25
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/flash-list

FlashList is a more performant FlatList replacement

  • 1.6.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
335K
decreased by-4.79%
Maintainers
25
Weekly downloads
 
Created

What is @shopify/flash-list?

@shopify/flash-list is a high-performance list component for React Native, designed to handle large datasets efficiently. It provides smooth scrolling and optimized rendering, making it suitable for applications that require handling extensive lists of data.

What are @shopify/flash-list's main functionalities?

Basic Usage

This code demonstrates the basic usage of the FlashList component to render a simple list of items.

import { FlashList } from '@shopify/flash-list';
import React from 'react';
import { View, Text } from 'react-native';

const data = [
  { key: '1', name: 'Item 1' },
  { key: '2', name: 'Item 2' },
  { key: '3', name: 'Item 3' }
];

const App = () => (
  <FlashList
    data={data}
    renderItem={({ item }) => (
      <View>
        <Text>{item.name}</Text>
      </View>
    )}
    keyExtractor={item => item.key}
  />
);

export default App;

Custom Item Layout

This code demonstrates how to customize the layout of each item in the FlashList component using styles.

import { FlashList } from '@shopify/flash-list';
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

const data = [
  { key: '1', name: 'Item 1' },
  { key: '2', name: 'Item 2' },
  { key: '3', name: 'Item 3' }
];

const App = () => (
  <FlashList
    data={data}
    renderItem={({ item }) => (
      <View style={styles.itemContainer}>
        <Text style={styles.itemText}>{item.name}</Text>
      </View>
    )}
    keyExtractor={item => item.key}
  />
);

const styles = StyleSheet.create({
  itemContainer: {
    padding: 10,
    borderBottomWidth: 1,
    borderBottomColor: '#ccc'
  },
  itemText: {
    fontSize: 18
  }
});

export default App;

Handling Large Datasets

This code demonstrates how to use the FlashList component to handle and render a large dataset efficiently.

import { FlashList } from '@shopify/flash-list';
import React from 'react';
import { View, Text } from 'react-native';

const data = Array.from({ length: 1000 }, (_, index) => ({ key: String(index), name: `Item ${index}` }));

const App = () => (
  <FlashList
    data={data}
    renderItem={({ item }) => (
      <View>
        <Text>{item.name}</Text>
      </View>
    )}
    keyExtractor={item => item.key}
  />
);

export default App;

Other packages similar to @shopify/flash-list

Keywords

FAQs

Package last updated on 09 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc