From 80cb318d7a603eeb4f7b62f13b0171744a2773eb Mon Sep 17 00:00:00 2001 From: Mark Rickert Date: Thu, 5 Oct 2023 09:41:54 -0600 Subject: [PATCH] chore: Remove FlashList recipe Ignite 9.0 integrates flashlist support by default with examples in the demo code converted over to FlashList so this recipe is no longer needed. --- docs/recipes/MigratingToFlashList.md | 92 ---------------------------- 1 file changed, 92 deletions(-) delete mode 100644 docs/recipes/MigratingToFlashList.md diff --git a/docs/recipes/MigratingToFlashList.md b/docs/recipes/MigratingToFlashList.md deleted file mode 100644 index fc820a8f..00000000 --- a/docs/recipes/MigratingToFlashList.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Migrating to FlashList -description: How to migrate over to Shopify's FlashList in an Ignite project -tags: - - Shopify - - FlashList -last_update: - author: Frank Calise -publish_date: 2022-10-13 ---- - -# Migrating to FlashList - -## Overview - -[Shopify's FlashList](https://shopify.github.io/flash-list/) provides a drop-in replacement for React Native's FlatList component. It's an easy refactor and your lists will perform better within your app! - -We'll start with the demo project provided by Ignite, so if you need a new one fire away with: - -```nodejs -npx ignite-cli new PizzaApp --yes -cd PizzaApp -``` - -## Project Dependencies - -Whether you're sticking with Expo or running with bare React Native workflow, our install steps are the same: - -```nodejs -npx expo install @shopify/flash-list -``` - -_Note: No `pod install` was run here because the scripts set up in an Ignite project take care of that for you!_ - -## Code Changes - -Open `DemoPodcastListScreen.tsx` and add the new import: - -```tsx -import { FlashList } from "@shopify/flash-list"; -``` - -Find the `FlatList` being used in the returned JSX and swap it out for `FlashList` - -```tsx -return ( - - // highlight-next-line - - data={episodeStore.episodesForList} - extraData={episodeStore.favorites.length + episodeStore.episodes.length} - contentContainerStyle={$flatListContentContainer} - refreshing={refreshing} - onRefresh={manualRefresh} - // ... - /> - // ... - -); -``` - -Run the app in the iOS simulator to test the changes, either `yarn expo:ios` or `yarn ios`. Navigate to the Podcast List screen: - -1. Press "Tap to sign in!" -2. Press "Let's go!" -3. Tap on the "Podcast" - -You'll get a warning out in the terminal, something similar to: - -```console - WARN estimatedItemSize FlashList prop is not defined - based on current configuration you can set - it to 187 to optimize list performance. Refer to FlashList documentation for more details. -``` - -Simply add that prop to the `FlashList` component with the suggested values: - -```tsx - - data={episodeStore.episodesForList} - // highlight-next-line - estimatedItemSize={187} - // ... -/> -``` - -Reload the app and take note that the warning message has cleared! - -Now everything looks like it did before, while also gaining all of the performance boosts from FlashList! It's a pretty straight forward approach and Shopify has done a good job helping the developer along with the useful console warnings as a guide.