diff --git a/native/app/Root.tsx b/native/app/Root.tsx index e859dd58e..c9cb0e043 100644 --- a/native/app/Root.tsx +++ b/native/app/Root.tsx @@ -1,7 +1,7 @@ import * as SplashScreen from "expo-splash-screen"; import { NavigationContainer, type NavigationContainerRef, type Theme } from "@react-navigation/native"; import { useEffect, useRef } from "react"; -import { StatusBar, useWindowDimensions, Text, Platform, Appearance, TextInput } from "react-native"; +import { StatusBar, useWindowDimensions, Platform, Appearance } from "react-native"; import { enableFreeze } from "react-native-screens"; import { object, parse, string } from "valibot"; import Toast from "react-native-toast-message"; @@ -108,25 +108,6 @@ function refreshIfNeeded() { function Root() { "use memo"; - // TODO: This hack turns off the font scaling. At some point accessibility will be added to the app. - interface TextWithDefaultProps extends Text { - defaultProps?: { allowFontScaling?: boolean }; - } - - interface TextInputWithDefaultProps extends TextInput { - defaultProps?: { allowFontScaling?: boolean }; - } - - (Text as unknown as TextWithDefaultProps).defaultProps = { - ...((Text as unknown as TextWithDefaultProps).defaultProps || {}), - allowFontScaling: false, - }; - - (TextInput as unknown as TextInputWithDefaultProps).defaultProps = { - ...((TextInput as unknown as TextInputWithDefaultProps).defaultProps || {}), - allowFontScaling: false, - }; - const authenticated = useGGStore((state) => state.authenticated); const navigationRef = useRef>(null); const { width } = useWindowDimensions(); diff --git a/native/app/UI/Login.tsx b/native/app/UI/Login.tsx index 17c3c8bc1..d38fe75cb 100644 --- a/native/app/UI/Login.tsx +++ b/native/app/UI/Login.tsx @@ -2,11 +2,12 @@ import type { NavigationProp } from "@react-navigation/native"; import { addEventListener, useURL } from "expo-linking"; import * as WebBrowser from "expo-web-browser"; import { useEffect, useState } from "react"; -import { Image, Platform, ScrollView, StyleSheet, Text, TextInput, View, useColorScheme } from "react-native"; +import { Image, Platform, ScrollView, StyleSheet, TextInput, View, useColorScheme } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import * as Haptics from "expo-haptics"; import { TouchableOpacity } from "react-native-gesture-handler"; +import Text from "@/app/UI/Text.tsx"; import { stateID } from "@/app/store/Authentication/AuthenticationLogic.ts"; import { useGGStore } from "@/app/store/GGStore.ts"; import { clientID, isLocalWeb, redirectURL } from "@/constants/env.ts"; @@ -60,6 +61,7 @@ function LocalWebLogin() { return ( <> { diff --git a/native/app/UI/MainDrawer.tsx b/native/app/UI/MainDrawer.tsx index 836d77005..14750e40c 100644 --- a/native/app/UI/MainDrawer.tsx +++ b/native/app/UI/MainDrawer.tsx @@ -1,10 +1,11 @@ import { type DrawerContentComponentProps, createDrawerNavigator, DrawerItem } from "@react-navigation/drawer"; import { Image } from "expo-image"; -import { Platform, StyleSheet, Text, TouchableOpacity, View } from "react-native"; +import { Platform, StyleSheet, TouchableOpacity, View } from "react-native"; import * as Haptics from "expo-haptics"; import * as SplashScreen from "expo-splash-screen"; import { useSafeAreaInsets } from "react-native-safe-area-context"; +import Text from "@/app/UI/Text.tsx"; import { useGGStore } from "@/app/store/GGStore.ts"; import { LOGO_DARK, SEARCH_ICON } from "@/app/utilities/Constants.ts"; import InventoryHeader from "@/app/inventory/pages/InventoryHeader.tsx"; @@ -102,7 +103,11 @@ function CustomDrawerContent({ navigation, state }: DrawerContentComponentProps) ( + + {"Inventory"} + + )} activeTintColor="white" inactiveTintColor="grey" activeBackgroundColor="#ffffff20" @@ -123,7 +128,11 @@ function CustomDrawerContent({ navigation, state }: DrawerContentComponentProps) onPress={() => navigation.navigate("Search")} /> ( + + {"Settings"} + + )} activeTintColor="white" inactiveTintColor="grey" activeBackgroundColor="#ffffff20" diff --git a/native/app/UI/Text.tsx b/native/app/UI/Text.tsx new file mode 100644 index 000000000..e097792e3 --- /dev/null +++ b/native/app/UI/Text.tsx @@ -0,0 +1,12 @@ +// Temp hack for now to stop text scaling +import { Text as RNText } from "react-native"; + +type Props = React.ComponentProps; + +export default function Text({ children, ...props }: Props) { + return ( + + {children} + + ); +} diff --git a/native/app/index.js b/native/app/index.js index 6ac1ce9c2..aebecf9bc 100644 --- a/native/app/index.js +++ b/native/app/index.js @@ -1,6 +1,12 @@ import "react-native-gesture-handler"; // Avoid crash in production https://reactnavigation.org/docs/stack-navigator/#installation import * as Sentry from "@sentry/react-native"; import { registerRootComponent } from "expo"; +import { Text, TextInput } from "react-native"; +Text.defaultProps = Text.defaultProps || {}; +Text.defaultProps.allowFontScaling = false; + +TextInput.defaultProps = Text.defaultProps || {}; +TextInput.defaultProps.allowFontScaling = false; import Root from "./Root.tsx"; diff --git a/native/app/inventory/cells/ArtifactCell.tsx b/native/app/inventory/cells/ArtifactCell.tsx index b42507c7d..c27f66637 100644 --- a/native/app/inventory/cells/ArtifactCell.tsx +++ b/native/app/inventory/cells/ArtifactCell.tsx @@ -1,7 +1,8 @@ import { useNavigation } from "@react-navigation/native"; import { Image } from "expo-image"; -import { StyleSheet, Text, View, TouchableOpacity } from "react-native"; +import { StyleSheet, View, TouchableOpacity } from "react-native"; +import Text from "@/app/UI/Text.tsx"; import type { DestinyItem } from "@/app/inventory/logic/Types.ts"; import { DEFAULT_OVERLAP_COLOR } from "@/app/utilities/Constants.ts"; import { ICON_SIZE, INNER_FRAME_SIZE } from "@/app/utilities/UISize.ts"; diff --git a/native/app/inventory/cells/DestinyCell.tsx b/native/app/inventory/cells/DestinyCell.tsx index 1cc140e44..94f6dc49e 100644 --- a/native/app/inventory/cells/DestinyCell.tsx +++ b/native/app/inventory/cells/DestinyCell.tsx @@ -1,7 +1,8 @@ import { useNavigation } from "@react-navigation/native"; import { Image } from "expo-image"; -import { Text, View, TouchableOpacity, StyleSheet } from "react-native"; +import { View, TouchableOpacity, StyleSheet } from "react-native"; +import Text from "@/app/UI/Text.tsx"; import { DestinyIconStyles, ICON_SIZE } from "@/app/utilities/UISize.ts"; import { CRAFTED_OVERLAY, ENHANCED_OVERLAY, getDamageTypeIconUri } from "@/app/utilities/Constants.ts"; import type { DestinyItem } from "@/app/inventory/logic/Types.ts"; diff --git a/native/app/inventory/cells/EngramCell.tsx b/native/app/inventory/cells/EngramCell.tsx index 6beeec037..d76f64372 100644 --- a/native/app/inventory/cells/EngramCell.tsx +++ b/native/app/inventory/cells/EngramCell.tsx @@ -1,7 +1,8 @@ import { useNavigation } from "@react-navigation/native"; import { Image } from "expo-image"; -import { StyleSheet, Text, TouchableOpacity, View } from "react-native"; +import { StyleSheet, TouchableOpacity, View } from "react-native"; +import Text from "@/app/UI/Text.tsx"; import { INNER_FRAME_SIZE, common } from "@/app/utilities/UISize.ts"; import { EMPTY_ENGRAM } from "@/app/utilities/Constants.ts"; import type { DestinyItem } from "@/app/inventory/logic/Types.ts"; diff --git a/native/app/inventory/pages/InventoryPage.tsx b/native/app/inventory/pages/InventoryPage.tsx index 2f688cc6e..58ee7030f 100644 --- a/native/app/inventory/pages/InventoryPage.tsx +++ b/native/app/inventory/pages/InventoryPage.tsx @@ -144,14 +144,11 @@ export default function InventoryPage({ inventoryPageEnum, pageEstimatedFlashLis /> } onLoad={() => { - if (index === pageData.length - 1) { - const p1 = useGGStore.getState().appStartupTime; - const p2 = performance.now(); - console.log("load time", `${(p2 - p1).toFixed(4)} ms`); + if (index === useGGStore.getState().currentListIndex) { setPageReady(true); jumpToCharacterRef.current(); opacity.value = withSpring(1, { - duration: 750, + duration: 1250, reduceMotion: ReduceMotion.System, }); } diff --git a/native/app/inventory/pages/InventoryPages.tsx b/native/app/inventory/pages/InventoryPages.tsx index 063959524..57c4ceb73 100644 --- a/native/app/inventory/pages/InventoryPages.tsx +++ b/native/app/inventory/pages/InventoryPages.tsx @@ -8,7 +8,7 @@ import ArmorPage from "@/app/inventory/pages/ArmorPage.tsx"; import GeneralPage from "@/app/inventory/pages/GeneralPage.tsx"; import { InventoryPageEnums } from "@/app/inventory/logic/Helpers.ts"; import { useGGStore } from "@/app/store/GGStore.ts"; -import OptionsMenu from "@/app/inventory/pages/OptionsMenu.tsx"; +import OptionsMenu from "@/components/ui/OptionsMenu.tsx"; function pageEnumToPageName(pageEnum: InventoryPageEnums): string { switch (pageEnum) { @@ -39,6 +39,7 @@ export default function InventoryPages() { detachInactiveScreens={true} initialRouteName={pageEnumToPageName(useGGStore.getState().currentInventoryPage)} screenOptions={() => ({ + tabBarAllowFontScaling: false, lazy: false, tabBarActiveTintColor: "white", tabBarInactiveTintColor: "gray", diff --git a/native/app/inventory/pages/SearchView.tsx b/native/app/inventory/pages/SearchView.tsx index 661728feb..2c0ef0128 100644 --- a/native/app/inventory/pages/SearchView.tsx +++ b/native/app/inventory/pages/SearchView.tsx @@ -218,6 +218,7 @@ export default function SearchView() { > {"Quantity to transfer:"}