fix: move now playing overlay on search tab to make space for input field

This commit is contained in:
Lei Nelissen
2023-06-20 22:57:49 +02:00
parent d15b7ea29d
commit fd3c3487be
2 changed files with 20 additions and 12 deletions

View File

@@ -107,7 +107,7 @@ function SelectActionButton() {
}
}
function NowPlaying() {
function NowPlaying({ offset = 0 }: { offset?: number }) {
const { index, track } = useCurrentTrack();
const { buffered, position } = useProgress();
const defaultStyles = useDefaultStyles();
@@ -165,7 +165,7 @@ function NowPlaying() {
}
return (
<Container style={{ bottom: tabBarHeight + NOW_PLAYING_POPOVER_MARGIN }}>
<Container style={{ bottom: tabBarHeight + NOW_PLAYING_POPOVER_MARGIN + offset }}>
{/** TODO: Fix shadow overflow on Android */}
{Platform.OS === 'ios' ? (
<ShadowOverlay pointerEvents='none'>

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { useRef, useState } from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import { THEME_COLOR } from '@/CONSTANTS';
import { t } from '@/localisation';
@@ -14,21 +14,29 @@ const Stack = createStackNavigator<StackParams>();
function SearchStack() {
const defaultStyles = useDefaultStyles();
const [isInitialRoute, setIsInitialRoute] = useState(true);
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<Stack.Navigator initialRouteName="Search" screenOptions={{
<Stack.Navigator initialRouteName="Search"
screenOptions={{
headerTintColor: THEME_COLOR,
headerTitleStyle: defaultStyles.stackHeader,
cardStyle: defaultStyles.view,
headerTransparent: true,
headerBackground: () => <ColoredBlurView style={StyleSheet.absoluteFill} />,
}}>
}}
screenListeners={{
state: (e) => {
const { state: { routes } } = e.data as { state: { routes?: { key: string, name: string }[] } };
setIsInitialRoute(routes?.length === 1);
}
}}
>
<Stack.Screen name="Search" component={Search} options={{ headerTitle: t('search'), headerShown: false }} />
<Stack.Screen name="Album" component={Album} options={{ headerTitle: t('album') }} />
</Stack.Navigator>
<NowPlaying />
<NowPlaying offset={isInitialRoute ? 64 : 0} />
</GestureHandlerRootView>
);
}