Skip to content

Commit

Permalink
[fix] questionable fix. Got build issues with react-virtualized, fixe…
Browse files Browse the repository at this point in the history
…d them with this (see link):

bvaughn/react-virtualized#1739
  • Loading branch information
aasvechn committed Jan 10, 2024
1 parent f6bd3ac commit 327adf1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,25 @@ import IosBottomSheet from "../components/ios/IosBottomSheet";
import { Input } from "@chakra-ui/input";
import { useIsLargeScreen } from "../utils/screenSize";
import { randomTorrent } from "../data";
import { List, WindowScroller } from "react-virtualized";
import "react-virtualized/styles.css";
import { FilterHeading } from "../components/Filters";
import stateDictionary from "../utils/StateDictionary";
import { useLocalStorage } from "usehooks-ts";
import { useFontSizeContext } from "../components/FontSizeProvider"; // only needs to be imported once

import { FC } from 'react';
import {
AutoSizer as _AutoSizer,
List as _List,
ListProps,
WindowScroller as _WindowScroller,
WindowScrollerProps,
} from 'react-virtualized';

export const VirtualizedList = _List as unknown as FC<ListProps> & _List;
export const VirtualizedWindowScroll = _WindowScroller as unknown as FC<WindowScrollerProps> & _WindowScroller;


const Home = () => {
const { mutate: resumeAll } = useMutation("resumeAll", TorrClient.resumeAll);

Expand Down Expand Up @@ -175,7 +187,7 @@ const Home = () => {
const fontSizeContext = useFontSizeContext();

return (
<WindowScroller>
<VirtualizedWindowScroll>
{({ isScrolling, scrollTop, width, height }) => (
<Flex flexDirection={"column"} width={"100%"} mt={isLarge ? 24 : 0}>
<PageHeader
Expand Down Expand Up @@ -384,7 +396,7 @@ const Home = () => {
</Flex>
)}

<List
<VirtualizedList
autoWidth
rowCount={Torrents.length}
rowHeight={(230 * fontSizeContext.scale) / 100}
Expand Down Expand Up @@ -430,7 +442,7 @@ const Home = () => {
</Flex>
</Flex>
)}
</WindowScroller>
</VirtualizedWindowScroll>
);
};

Expand Down

0 comments on commit 327adf1

Please sign in to comment.