fix(types): resolve TypeScript errors in orientation handling

- Import OrientationLock and Orientation types from .tv.ts module
- Add explicit type annotations to orientation event handlers
- Change ScreenOrientationEnum to use Record<number, string>
- Use OrientationLock enum type instead of runtime value

This fixes ReactCodegen build failures caused by TypeScript errors.
This commit is contained in:
Uruk
2025-11-16 00:56:23 +01:00
parent d6ccd6f756
commit d89449b1bf
3 changed files with 32 additions and 20 deletions

View File

@@ -1,8 +1,8 @@
# 📦 Pull Request
# 📦 chore(deps): upgrade deps and fix iOS build
## 🔖 Summary
Upgrade runtime dependencies (react-i18next, react-native-worklets) and improve TypeScript type safety for screen orientation handling.
Upgrade runtime dependencies (react-i18next, react-native-worklets), improve TypeScript type safety for screen orientation handling, and fix iOS build error from develop branch.
## 🏷️ Ticket / Issue
@@ -12,14 +12,21 @@ None
- **Type**: chore
- **Scope**: deps, refactor
- **Summary**: Upgraded react-i18next and react-native-worklets to latest versions, improved type safety for screen orientation APIs
- **Summary**: Upgraded react-i18next and react-native-worklets to latest versions, improved type safety for screen orientation APIs, and fixed iOS build error
## 📋 Details
This PR upgrades key runtime dependencies and improves type safety across orientation-related code.
This PR upgrades key runtime dependencies, improves type safety across orientation-related code, and fixes an iOS build error present in the develop branch.
### Changes Made
**iOS Build Fix:**
- Removed root-level `icon` field from `app.json` to resolve Xcode build failure
- The iOS-specific liquid glass icon format was causing asset catalog compilation errors
- Build error: "None of the input catalogs contained a matching stickers icon set or app icon set named 'icon-ios-liquid-glass'"
- Removing the root icon allows the iOS-specific icon to be processed correctly
**Runtime Dependencies Updated:**
- `react-i18next`: 15.4.0 → 16.3.3 (latest internationalization features and improvements)
@@ -67,10 +74,13 @@ None
- [x] Screen rotation works correctly on mobile
- [x] Orientation lock/unlock functions work
- [x] TV platform continues to use landscape orientation
6. Test i18n functionality:
6. Test iOS build:
- [x] iOS build completes successfully without icon-related errors
- [x] App icons display correctly on iOS devices
7. Test i18n functionality:
- [x] Language switching works
- [x] Translations load correctly
7. Verification steps:
8. Verification steps:
- [x] All commands complete successfully
- [x] No runtime errors
- [x] Orientation behavior unchanged

View File

@@ -1,8 +1,10 @@
import { useEffect, useState } from "react";
import { Platform } from "react-native";
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
import { OrientationLock } from "@/packages/expo-screen-orientation";
import { Orientation } from "../packages/expo-screen-orientation.tv";
import {
Orientation,
OrientationLock,
} from "../packages/expo-screen-orientation.tv";
const orientationToOrientationLock = (
orientation: Orientation,
@@ -30,13 +32,15 @@ export const useOrientation = () => {
if (Platform.isTV) return;
const orientationSubscription =
ScreenOrientation.addOrientationChangeListener((event) => {
setOrientation(
orientationToOrientationLock(event.orientationInfo.orientation),
);
});
ScreenOrientation.addOrientationChangeListener(
(event: { orientationInfo: { orientation: Orientation } }) => {
setOrientation(
orientationToOrientationLock(event.orientationInfo.orientation),
);
},
);
ScreenOrientation.getOrientationAsync().then((orientation) => {
ScreenOrientation.getOrientationAsync().then((orientation: Orientation) => {
setOrientation(orientationToOrientationLock(orientation));
});

View File

@@ -11,6 +11,7 @@ import { useCallback, useEffect, useMemo } from "react";
import { Platform } from "react-native";
import { BITRATES, type Bitrate } from "@/components/BitrateSelector";
import * as ScreenOrientation from "@/packages/expo-screen-orientation";
import { OrientationLock } from "@/packages/expo-screen-orientation.tv";
import { apiAtom } from "@/providers/JellyfinProvider";
import { writeInfoLog } from "@/utils/log";
import { storage } from "../mmkv";
@@ -25,10 +26,7 @@ export type DownloadOption = {
value: DownloadQuality;
};
export const ScreenOrientationEnum: Record<
ScreenOrientation.OrientationLock,
string
> = {
export const ScreenOrientationEnum: Record<number, string> = {
[ScreenOrientation.OrientationLock.DEFAULT]:
"home.settings.other.orientations.DEFAULT",
[ScreenOrientation.OrientationLock.ALL]:
@@ -154,7 +152,7 @@ export type Settings = {
subtitleMode: SubtitlePlaybackMode;
rememberSubtitleSelections: boolean;
showHomeTitles: boolean;
defaultVideoOrientation: ScreenOrientation.OrientationLock;
defaultVideoOrientation: OrientationLock;
forwardSkipTime: number;
rewindSkipTime: number;
showCustomMenuLinks: boolean;
@@ -218,7 +216,7 @@ export const defaultValues: Settings = {
subtitleMode: SubtitlePlaybackMode.Default,
rememberSubtitleSelections: true,
showHomeTitles: true,
defaultVideoOrientation: ScreenOrientation.OrientationLock.DEFAULT,
defaultVideoOrientation: OrientationLock.DEFAULT,
forwardSkipTime: 30,
rewindSkipTime: 10,
showCustomMenuLinks: false,