Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

fix: url in drop screen #2325

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Changes from 1 commit
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
22 changes: 13 additions & 9 deletions packages/app/screens/swipe-list.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useMemo } from "react";
import { Platform } from "react-native";

import { useSafeAreaInsets } from "@showtime-xyz/universal.safe-area";
Expand Down Expand Up @@ -57,9 +58,10 @@ const FeedSwipeList = () => {
const { data } = useFeed();
const [initialScrollItemId] = useParam("initialScrollItemId");
const { bottom: safeAreaBottom } = useSafeAreaInsets();
const initialScrollIndex = data?.findIndex(
(item) => item.nft_id == initialScrollItemId
);
const initialScrollIndex = useMemo(() => {
const index = data?.findIndex((item) => item.nft_id == initialScrollItemId);
return index === -1 ? 0 : index;
}, [data, initialScrollItemId]);

return (
<SwipeList
Expand Down Expand Up @@ -89,9 +91,10 @@ const ProfileSwipeList = () => {
);
const { bottom: safeAreaBottom } = useSafeAreaInsets();

const initialScrollIndex = data?.findIndex(
(item) => item.nft_id == initialScrollItemId
);
const initialScrollIndex = useMemo(() => {
const index = data?.findIndex((item) => item.nft_id == initialScrollItemId);
hirbod marked this conversation as resolved.
Show resolved Hide resolved
return index === -1 ? 0 : index;
}, [data, initialScrollItemId]);

return (
<MutateProvider mutate={updateItem}>
Expand Down Expand Up @@ -123,9 +126,10 @@ const TrendingNFTsSwipeList = () => {
filter,
});
const { bottom: safeAreaBottom } = useSafeAreaInsets();
const initialScrollIndex = data?.findIndex(
(item) => item.nft_id == initialScrollItemId
);
const initialScrollIndex = useMemo(() => {
const index = data?.findIndex((item) => item.nft_id == initialScrollItemId);
return index === -1 ? 0 : index;
}, [data, initialScrollItemId]);

return (
<SwipeList
Expand Down
Loading