Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Flatlist from RN to gesture handler #982

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/core/src/components/FlatList.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import { FlatList as FlatListstComponent } from "react-native";
import { FlatList as FlatListComponent } from "react-native-gesture-handler";
import type { FlatListProps } from "react-native";

const FlatList = React.forwardRef<FlatListstComponent, FlatListProps<any>>(
const FlatList = React.forwardRef<FlatListComponent, FlatListProps<any>>(
<T extends any>(
{ numColumns, ...rest }: FlatListProps<T>,
ref: React.Ref<FlatListstComponent>
ref: React.Ref<FlatListComponent>
) => {
return (
<FlatListstComponent
<FlatListComponent
key={numColumns} // Changing numColumns requires re-rendering, setting it as the key ensures list is re-rendered when it changes
numColumns={numColumns}
ref={ref}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/components/SectionList/SectionList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { FlashListProps, FlashList } from "@shopify/flash-list";
import { FlatListProps, FlatList as FlatListComponent } from "react-native";
import { FlatListProps } from "react-native";
import { FlatList as FlatListComponent } from "react-native-gesture-handler";
import SectionHeader, { DefaultSectionHeader } from "./SectionHeader";
import { flattenReactFragments } from "../../utilities";
import FlatList from "../FlatList";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import FlatList from "../FlatList";
import { FlatList as FlatListComponent } from "react-native";
import { FlatList as FlatListComponent } from "react-native-gesture-handler";
import type { FlatListProps } from "react-native";
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
FlashListSectionListProps,
} from "../SectionList";
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
import { FlatList } from "react-native";
import { FlatList } from "react-native-gesture-handler";
import { FlashList } from "@shopify/flash-list";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
FlatListSwipeableListProps,
} from "../SwipeableItem";
import useSplitContentContainerStyles from "./useSplitContentContainerStyles";
import { FlatList } from "react-native";
import { FlatList } from "react-native-gesture-handler";
import { FlashList } from "@shopify/flash-list";

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/components/SwipeableItem/SwipeableList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { FlashListProps, FlashList } from "@shopify/flash-list";
import { FlatListProps, FlatList as FlatListComponent } from "react-native";
import { FlatListProps } from "react-native";
import { FlatList as FlatListComponent } from "react-native-gesture-handler";
import FlatList from "../FlatList";

type ListComponentType = "FlatList" | "FlashList";
Expand Down
Loading