mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-20 12:40:15 +02:00
fix queue panel bug
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Pressable, StyleSheet, View } from 'react-native';
|
import { Pressable, StyleSheet, View, useWindowDimensions } from 'react-native';
|
||||||
import { Image } from 'expo-image';
|
import { Image } from 'expo-image';
|
||||||
import { Ionicons } from '@expo/vector-icons';
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
@@ -131,8 +131,16 @@ interface QueueTrayProps {
|
|||||||
|
|
||||||
export function QueueTray({ onClose }: QueueTrayProps) {
|
export function QueueTray({ onClose }: QueueTrayProps) {
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
const { height: windowHeight } = useWindowDimensions();
|
||||||
const snapPoints = useMemo(() => ['58%', '100%'], []);
|
const snapPoints = useMemo(() => ['58%', '100%'], []);
|
||||||
const renderFlashListScrollComponent = useBottomSheetScrollableCreator();
|
const renderFlashListScrollComponent = useBottomSheetScrollableCreator();
|
||||||
|
// While the sheet-open animation runs, the bottom-sheet scrollable can
|
||||||
|
// momentarily fail to constrain the list, so FlashList measures its viewport
|
||||||
|
// as the full CONTENT height (~100k dp for a long queue), believes every row
|
||||||
|
// is visible, and mounts thousands of views — a multi-second main-thread
|
||||||
|
// freeze. Clamping the list container to the window height caps the viewport
|
||||||
|
// no matter what the sheet reports; both snap points stay unaffected.
|
||||||
|
const listClampStyle = useMemo(() => ({ maxHeight: windowHeight }), [windowHeight]);
|
||||||
|
|
||||||
const { tracks, activeIndex, hasSnapshot, refresh } = useQueue(true);
|
const { tracks, activeIndex, hasSnapshot, refresh } = useQueue(true);
|
||||||
const currentTrack = activeIndex >= 0 ? tracks[activeIndex] : undefined;
|
const currentTrack = activeIndex >= 0 ? tracks[activeIndex] : undefined;
|
||||||
@@ -582,6 +590,7 @@ export function QueueTray({ onClose }: QueueTrayProps) {
|
|||||||
<FlashList
|
<FlashList
|
||||||
data={entries}
|
data={entries}
|
||||||
scrollEnabled={!editMode}
|
scrollEnabled={!editMode}
|
||||||
|
style={listClampStyle}
|
||||||
keyExtractor={(item) => item.key}
|
keyExtractor={(item) => item.key}
|
||||||
drawDistance={QUEUE_ROW_HEIGHT * 12}
|
drawDistance={QUEUE_ROW_HEIGHT * 12}
|
||||||
maintainVisibleContentPosition={{ disabled: true }}
|
maintainVisibleContentPosition={{ disabled: true }}
|
||||||
|
|||||||
Reference in New Issue
Block a user