mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-30 18:48:30 +01:00
Compatibility migration from SDK 55 to SDK 56 (react-native-tvos 0.85.3-0, React 19.2.3). Phase 1 = breaking changes needed to build; new-feature adoption and TypeScript 6 are deferred to Phase 2. - Deps aligned to SDK 56 via `expo install --fix` (all expo-* 56.x, screens 4.25.2, reanimated 4.3.1, worklets 0.8.3, gesture-handler 2.31.x, svg 15.15.4) - react-native -> react-native-tvos@0.85.3-0; react/react-dom 19.2.3 - expo-router forked React Navigation: ran the SDK 56 codemod (@react-navigation/* imports -> expo-router/*), removed the 3 now-unused direct @react-navigation/* dependencies, retyped NestedTabPageStack via expo-router Stack.Screen options - StyleSheet.absoluteFillObject -> absoluteFill (removed from RN 0.85 types) - app.json ios.deploymentTarget 15.6 -> 16.4 (SDK 56 minimum) - CI: Xcode 26.2 -> 26.4; made xcode-version Renovate-managed via a customManager + xcodereleases customDatasource - @babel/core 7.29.7; dropped version-locked screens/codegen bun-patches (no longer applicable on SDK 56) Deferred to Phase 2: TypeScript 6 (toolchain: @types/node, jest globals, UdpSocket typing), @expo/vector-icons -> @react-native-vector-icons codemod. typecheck passes. expo-doctor: 2 known failures remain (react-native-track-player New Arch fork; typescript major mismatch pending the deferred TS6 bump).
33 lines
865 B
TypeScript
33 lines
865 B
TypeScript
import {
|
|
type QueryKey,
|
|
type UseQueryOptions,
|
|
type UseQueryResult,
|
|
useQuery,
|
|
} from "@tanstack/react-query";
|
|
import { useFocusEffect } from "expo-router/react-navigation";
|
|
import { useCallback } from "react";
|
|
|
|
export function useReactNavigationQuery<
|
|
TQueryFnData = unknown,
|
|
TError = unknown,
|
|
TData = TQueryFnData,
|
|
TQueryKey extends QueryKey = QueryKey,
|
|
>(
|
|
options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,
|
|
): UseQueryResult<TData, TError> {
|
|
const useQueryReturn = useQuery(options);
|
|
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
if (
|
|
((options.refetchOnWindowFocus && useQueryReturn.isStale) ||
|
|
options.refetchOnWindowFocus === "always") &&
|
|
options.enabled !== false
|
|
)
|
|
useQueryReturn.refetch();
|
|
}, [options.enabled, options.refetchOnWindowFocus]),
|
|
);
|
|
|
|
return useQueryReturn;
|
|
}
|