diff --git a/components/Artist/index.tsx b/components/Artist/index.tsx index d679100f..a75f2149 100644 --- a/components/Artist/index.tsx +++ b/components/Artist/index.tsx @@ -13,7 +13,6 @@ import { YStack } from "tamagui"; import BlurhashedImage from "../Global/components/blurhashed-image"; import FavoriteButton from "../Global/components/favorite-button"; import { ItemCard } from "../Global/components/item-card"; -import { Freeze } from "react-freeze"; import { H2 } from "../Global/helpers/text"; export function ArtistScreen({ @@ -24,8 +23,6 @@ export function ArtistScreen({ navigation: NativeStackNavigationProp }): React.JSX.Element { - const freeze = !useIsFocused(); - const { artist } = route.params; navigation.setOptions({ @@ -64,45 +61,43 @@ export function ArtistScreen({ }); return ( - - - - - + + + + -

Albums

- { - return ( - { - navigation.navigate('Album', { - album - }) - }} - /> - ) - }} - /> -
-
+

Albums

+ { + return ( + { + navigation.navigate('Album', { + album + }) + }} + /> + ) + }} + /> + ) } \ No newline at end of file diff --git a/components/Home/component.tsx b/components/Home/component.tsx index 95ea167c..c1b03efa 100644 --- a/components/Home/component.tsx +++ b/components/Home/component.tsx @@ -8,8 +8,6 @@ import { useHomeContext } from "./provider"; import { H3 } from "../Global/helpers/text"; import Client from "../../api/client"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; -import { useIsFocused } from "@react-navigation/native"; -import { Freeze } from "react-freeze"; export function ProvidedHome({ navigation @@ -17,40 +15,36 @@ export function ProvidedHome({ navigation: NativeStackNavigationProp }): React.JSX.Element { - const freeze = !useIsFocused() - const { refreshing: refetching, onRefresh } = useHomeContext() return ( - - - } - removeClippedSubviews // Save memory usage - > - - -

{`Hi, ${Client.user!.name}`}

-
+ + } + removeClippedSubviews // Save memory usage + > + + +

{`Hi, ${Client.user!.name}`}

+
- + - + - + - + - + - -
-
-
+ + + ); } \ No newline at end of file diff --git a/components/Home/stack.tsx b/components/Home/stack.tsx index ac1e6203..e8a900ff 100644 --- a/components/Home/stack.tsx +++ b/components/Home/stack.tsx @@ -28,12 +28,6 @@ export default function Home(): React.JSX.Element { - { nowPlaying && ( <> @@ -363,6 +360,5 @@ export default function PlayerScreen({ )} - ); } \ No newline at end of file diff --git a/components/Player/screens/queue.tsx b/components/Player/screens/queue.tsx index b04c2194..ad3a7284 100644 --- a/components/Player/screens/queue.tsx +++ b/components/Player/screens/queue.tsx @@ -6,11 +6,8 @@ import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import { useSafeAreaFrame } from "react-native-safe-area-context"; import DraggableFlatList from "react-native-draggable-flatlist"; import { trigger } from "react-native-haptic-feedback"; -import { getTokens, Separator, View } from "tamagui"; -import { FadeIn, FadeOut, ReduceMotion, SequencedTransition } from "react-native-reanimated"; -import { useFocusEffect, useIsFocused } from "@react-navigation/native"; -import { useCallback, useState } from "react"; -import { Freeze } from "react-freeze"; +import { Separator } from "tamagui"; +import { useIsFocused } from "@react-navigation/native"; export default function Queue({ navigation }: { navigation: NativeStackNavigationProp}): React.JSX.Element { @@ -32,56 +29,54 @@ export default function Queue({ navigation }: { navigation: NativeStackNavigatio const freeze = !useIsFocused(); return ( - - ( - { length: width / 9, offset: width / 9 * index, index} - )} - initialScrollIndex={scrollIndex !== -1 ? scrollIndex: 0} - ItemSeparatorComponent={() => } - // itemEnteringAnimation={FadeIn} - // itemExitingAnimation={FadeOut} - // itemLayoutAnimation={SequencedTransition} - keyExtractor={({ item }, index) => { - return `${index}-${item.Id}` - }} - numColumns={1} - onDragEnd={({ data, from, to}) => { - useReorderQueue.mutate({ newOrder: data, from, to }); - }} - renderItem={({ item: queueItem, getIndex, drag, isActive }) => { - - const index = getIndex(); - - return ( - { - useSkip.mutate(index); - }} - onLongPress={() => { - trigger('impactLight'); - drag(); - }} - isNested - showRemove - onRemove={() => { - if (index) - useRemoveFromQueue.mutate(index) - }} - /> - ) - }} - /> - + ( + { length: width / 9, offset: width / 9 * index, index} + )} + initialScrollIndex={scrollIndex !== -1 ? scrollIndex: 0} + ItemSeparatorComponent={() => } + // itemEnteringAnimation={FadeIn} + // itemExitingAnimation={FadeOut} + // itemLayoutAnimation={SequencedTransition} + keyExtractor={({ item }, index) => { + return `${index}-${item.Id}` + }} + numColumns={1} + onDragEnd={({ data, from, to}) => { + useReorderQueue.mutate({ newOrder: data, from, to }); + }} + renderItem={({ item: queueItem, getIndex, drag, isActive }) => { + + const index = getIndex(); + + return ( + { + useSkip.mutate(index); + }} + onLongPress={() => { + trigger('impactLight'); + drag(); + }} + isNested + showRemove + onRemove={() => { + if (index) + useRemoveFromQueue.mutate(index) + }} + /> + ) + }} + /> ) } \ No newline at end of file diff --git a/index.js b/index.js index e8cb4d63..b78c47f3 100644 --- a/index.js +++ b/index.js @@ -7,11 +7,17 @@ import TrackPlayer from 'react-native-track-player'; import Client from './api/client'; import { enableFreeze, enableScreens } from "react-native-screens"; +// Initialize API client instance Client.instance; -enableFreeze(true); +// Enable React Navigation freeze for detaching inactive screens +enableFreeze(); + +// TODO: I don't think this is needed with React Navigation 6+ enableScreens(); AppRegistry.registerComponent(appName, () => App); -AppRegistry.registerComponent('RNCarPlayScene', () => App) +AppRegistry.registerComponent('RNCarPlayScene', () => App); + +// Register RNTP playback service for remote controls TrackPlayer.registerPlaybackService(() => PlaybackService); \ No newline at end of file