Skip to content
Merged
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
16 changes: 10 additions & 6 deletions packages/mobile/src/screens/track-screen/RemixContestSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,11 @@ export const RemixContestSection = ({
const hasPrizeInfo = !!remixContest?.eventData?.prizeInfo

const [index, setIndex] = useState(0)
const [routes] = useState<Route[]>([
{ key: 'details', title: 'Details' },
...(hasPrizeInfo ? [{ key: 'prizes', title: 'Prizes' }] : []),
{ key: 'submissions', title: 'Submissions' }
])
const [routes, setRoutes] = useState<Route[]>([])
const [heights, setHeights] = useState({})
const [firstRender, setFirstRender] = useState(true)
const animatedHeight = useSharedValue(TAB_HEADER_HEIGHT)
const currentHeight = heights[routes[index].key]
const currentHeight = heights[routes[index]?.key]
const previousHeight = usePrevious(currentHeight)
const hasHeightChanged = currentHeight !== previousHeight

Expand All @@ -99,6 +95,14 @@ export const RemixContestSection = ({
}
}, [firstRender])

useEffect(() => {
setRoutes([
{ key: 'details', title: 'Details' },
...(hasPrizeInfo ? [{ key: 'prizes', title: 'Prizes' }] : []),
{ key: 'submissions', title: 'Submissions' }
])
}, [hasPrizeInfo])

const handleLayout = (key: string) => (e: any) => {
const height = e.nativeEvent.layout.height
setHeights((prev) => {
Expand Down