mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-05 18:40:01 -06:00
context sheet fixes on android
This commit is contained in:
@@ -7,9 +7,8 @@ import Login from './Login'
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'
|
||||
import Context from './Context'
|
||||
import { getItemName } from '../utils/text'
|
||||
import { useCallback } from 'react'
|
||||
import AddToPlaylistSheet from './AddToPlaylist'
|
||||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models'
|
||||
import { Platform } from 'react-native'
|
||||
|
||||
const RootStack = createNativeStackNavigator<RootStackParamList>()
|
||||
|
||||
@@ -18,28 +17,6 @@ export default function Root(): React.JSX.Element {
|
||||
|
||||
const { api, library } = useJellifyContext()
|
||||
|
||||
const getContextSheetDetents = useCallback(
|
||||
(artists: string[] | null | undefined, type: BaseItemKind | undefined) => {
|
||||
let detent: number = 0
|
||||
|
||||
switch (type) {
|
||||
case 'Audio':
|
||||
detent = 0.3
|
||||
break
|
||||
case 'MusicAlbum':
|
||||
detent = 0.25
|
||||
break
|
||||
case 'Playlist':
|
||||
detent = 0.2
|
||||
break
|
||||
default:
|
||||
detent = 0.15
|
||||
}
|
||||
return [detent + (artists?.length ?? 1) * 0.075]
|
||||
},
|
||||
[],
|
||||
)
|
||||
|
||||
return (
|
||||
<RootStack.Navigator
|
||||
initialRouteName={api && library ? 'Tabs' : 'Login'}
|
||||
@@ -90,7 +67,7 @@ export default function Root(): React.JSX.Element {
|
||||
component={AddToPlaylistSheet}
|
||||
options={{
|
||||
headerTitle: 'Add to Playlist',
|
||||
presentation: 'formSheet',
|
||||
presentation: Platform.OS === 'ios' ? 'formSheet' : 'modal',
|
||||
sheetAllowedDetents: 'fitToContents',
|
||||
sheetGrabberVisible: true,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user