Compare commits
2
Commits
No files matched your search
@@ -1,45 +0,0 @@
|
||||
import type { MenuComponentProps } from "@expo/ui/community/menu"
|
||||
import { Button, Host, Menu, RNHostView } from "@expo/ui/swift-ui"
|
||||
import { disabled, menuOrder } from "@expo/ui/swift-ui/modifiers"
|
||||
|
||||
// SwiftUI's automatic order reverses menus that open upward in the player.
|
||||
// Keep the same top-to-bottom order as the UIKit long-press menus.
|
||||
export function MenuView({
|
||||
actions,
|
||||
children,
|
||||
style,
|
||||
testID,
|
||||
onPressAction,
|
||||
}: MenuComponentProps) {
|
||||
return (
|
||||
<Host matchContents style={style} testID={testID} ignoreSafeArea="all">
|
||||
<Menu
|
||||
modifiers={[menuOrder("fixed")]}
|
||||
label={
|
||||
<RNHostView matchContents>
|
||||
<>{children}</>
|
||||
</RNHostView>
|
||||
}
|
||||
>
|
||||
{actions
|
||||
.filter((action) => !action.attributes?.hidden)
|
||||
.map((action) => (
|
||||
<Button
|
||||
key={action.id ?? action.title}
|
||||
label={action.title}
|
||||
systemImage={
|
||||
typeof action.image === "string" ? action.image : undefined
|
||||
}
|
||||
role={action.attributes?.destructive ? "destructive" : undefined}
|
||||
modifiers={[disabled(action.attributes?.disabled ?? false)]}
|
||||
onPress={() =>
|
||||
onPressAction?.({
|
||||
nativeEvent: { event: action.id ?? action.title },
|
||||
})
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Menu>
|
||||
</Host>
|
||||
)
|
||||
}
|
||||
@@ -376,8 +376,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
|
||||
const handlePlaylistStatusUpdate = useCallback(
|
||||
(status: AudioPlaylistStatus) => {
|
||||
// iOS may remove the finished item before delivering its final status.
|
||||
if (!status.isLoaded && !status.didJustFinish) return
|
||||
if (!status.isLoaded) return
|
||||
const state = storeRef.current.getState()
|
||||
if (loadedSongIdsRef.current[status.currentIndex] !== state.queue[0]) {
|
||||
return
|
||||
@@ -428,14 +427,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
isPlayingRef.current = false
|
||||
setIsPlayingState(false)
|
||||
storeRef.current.update(playbackQueue.skipNext)
|
||||
const playlist = playlistRef.current
|
||||
if (playlist) {
|
||||
playlist.pause()
|
||||
// Reload the final item, which iOS removes when playback ends.
|
||||
ignoreTrackChangeRef.current = true
|
||||
playlist.skipTo(status.currentIndex)
|
||||
scheduleTrackChangeHandling()
|
||||
}
|
||||
void playlistRef.current?.seekTo(0)
|
||||
currentTimeRef.current = 0
|
||||
setCurrentTime(0)
|
||||
return
|
||||
@@ -451,7 +443,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
playlist?.play()
|
||||
}
|
||||
},
|
||||
[scheduleTrackChangeHandling]
|
||||
[]
|
||||
)
|
||||
|
||||
const handleTrackChanged = useCallback(
|
||||
|
||||
@@ -955,7 +955,6 @@ export function PlaybackProvider({ children }: { children: ReactNode }) {
|
||||
if (!shouldContinuePlaying) {
|
||||
autoPlayNextRef.current = false
|
||||
isPlayingRef.current = false
|
||||
audio.pause()
|
||||
audio.currentTime = 0
|
||||
currentTimeRef.current = 0
|
||||
setCurrentTime(0)
|
||||
|
||||
Reference in new issue
Block a user