Skip to content

Commit

Permalink
Set minimum height of horizontal items
Browse files Browse the repository at this point in the history
  • Loading branch information
zoriya committed Dec 12, 2023
1 parent 9ffd0c3 commit 4dcf21a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion front/packages/ui/src/fetch-infinite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@
import { Page, QueryIdentifier, useInfiniteFetch } from "@kyoo/models";
import { useBreakpointMap, HR } from "@kyoo/primitives";
import { ContentStyle, FlashList } from "@shopify/flash-list";
import { ComponentProps, ComponentType, isValidElement, ReactElement, useRef } from "react";
import {
ComponentProps,
ComponentType,
isValidElement,
ReactElement,
useCallback,
useReducer,
useRef,
useState,
} from "react";
import { EmptyView, ErrorView, Layout, WithLoading, addHeader } from "./fetch";
import { FlatList, View, ViewStyle } from "react-native";

Expand Down Expand Up @@ -122,6 +131,7 @@ export const InfiniteFetchList = <Data, Props, _, Kind>({
layout.layout === "horizontal" && {
width:
size * (getItemType && getItemSize ? getItemSize(getItemType(item, index)) : 1),
height: size * 2,
},
]}
>
Expand Down
4 changes: 3 additions & 1 deletion front/packages/ui/src/fetch-infinite.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const InfiniteFetchList = <Data, _, HeaderProps, Kind>({
Header,
headerProps,
getItemType,
nested,
...props
}: {
query: ReturnType<typeof useInfiniteFetch<_, Data>>;
Expand All @@ -165,9 +166,10 @@ export const InfiniteFetchList = <Data, _, HeaderProps, Kind>({
Header?: ComponentType<{ children: JSX.Element } & HeaderProps> | ReactElement;
headerProps: HeaderProps;
getItemType?: (item: WithLoading<Data>, index: number) => Kind;
getItemSize?: (kind: Kind) => number
getItemSize?: (kind: Kind) => number;
fetchMore?: boolean;
contentContainerStyle?: ContentStyle;
nested?: boolean;
}): JSX.Element | null => {
const oldItems = useRef<Data[] | undefined>();
const { items, error, fetchNextPage, hasNextPage, isFetching } = query;
Expand Down

0 comments on commit 4dcf21a

Please sign in to comment.