diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index 2d24f120..e93a4d1f 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -124,7 +124,6 @@ export default ({ config }: ConfigContext): ExpoConfig => ({ ios: { deploymentTarget: '16.4', useFrameworks: 'static', - enableSceneSupport: true, }, }, ], diff --git a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/_layout.tsx b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/_layout.tsx index 7c1ae3f2..25a225d8 100644 --- a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/_layout.tsx +++ b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/_layout.tsx @@ -2,30 +2,24 @@ import { useAuth } from '../../../providers/AuthProvider'; import { useTheme } from '../../../providers/ThemeProvider'; import { Stack } from 'expo-router'; import { upperFirst } from 'lodash'; -import { useMemo } from 'react'; import { useTranslations } from 'use-intl'; +export const unstable_settings = { + // One anchor per segment of the shared route. The former value also branched on `user`, + // which `Stack.Protected` below now decides on its own: an unauthenticated visitor never + // gets `feed` or `collection/(tabs)` registered, so there is nothing to anchor to. + anchor: 'index', + search: { anchor: 'search' }, + collection: { anchor: 'collection/(tabs)' }, + feed: { anchor: 'feed' }, +}; + const AppLayout = ({ segment }: { segment: string }) => { const { defaultScreenOptions } = useTheme(); const t = useTranslations(); const { user } = useAuth(); - const initialRouteName = useMemo(() => { - switch (segment) { - case '(search)': - return 'search'; - case '(feed)': - // 'feed' is only registered in the Stack when guard={!!user} passes (see below). - return user ? 'feed' : 'index'; - case '(collection)': - // 'collection/(tabs)' is only registered in the Stack when guard={!!user} passes (see below). - return user ? 'collection/(tabs)' : 'index'; - default: - return 'index'; - } - }, [segment, user]); - return ( - + , - MaterialTopTabNavigationEventMap ->(Tab.Navigator); - const CollectionLayout = () => { const t = useTranslations(); const router = useRouter(); @@ -136,17 +122,15 @@ const CollectionLayout = () => { ], }} /> - } - > - - }> + + - + ); }; diff --git a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/feed/_layout.tsx b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/feed/_layout.tsx index b944d460..8b01701a 100644 --- a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/feed/_layout.tsx +++ b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/feed/_layout.tsx @@ -1,40 +1,25 @@ -import { - createMaterialTopTabNavigator, - MaterialTopTabBarProps, - MaterialTopTabNavigationEventMap, - MaterialTopTabNavigationOptions, -} from 'expo-router/js-top-tabs'; -import { ParamListBase, TabNavigationState } from 'expo-router/react-navigation'; -import { withLayoutContext } from 'expo-router'; +import { MaterialTopTabBarProps, TopTabs } from 'expo-router/js-top-tabs'; import { upperFirst } from 'lodash'; import { useTranslations } from 'use-intl'; import { SegmentedControlTabBar } from '../../../../components/ui/segmented-control-tabbar'; -const Tab = createMaterialTopTabNavigator(); - -const MaterialTopTabs = withLayoutContext< - MaterialTopTabNavigationOptions, - typeof Tab.Navigator, - TabNavigationState, - MaterialTopTabNavigationEventMap ->(Tab.Navigator); +export const unstable_settings = { + anchor: 'index', +}; const FeedLayout = () => { const t = useTranslations(); return ( - } - > - }> + - - + ); }; diff --git a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/search/_layout.tsx b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/search/_layout.tsx index b9a7cd08..60e89462 100644 --- a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/search/_layout.tsx +++ b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/search/_layout.tsx @@ -6,6 +6,10 @@ import { upperFirst } from 'lodash'; import { useCallback, useEffect, useState } from 'react'; import { useTranslations } from 'use-intl'; +export const unstable_settings = { + anchor: '(tabs)', +}; + const SearchLayout = () => { const t = useTranslations(); const pathname = usePathname(); @@ -79,7 +83,7 @@ const SearchLayout = () => { ...headerSearchBar, }} /> - + ); }; diff --git a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/user/[username]/(follow)/_layout.tsx b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/user/[username]/(follow)/_layout.tsx index a0610d6b..95505029 100644 --- a/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/user/[username]/(follow)/_layout.tsx +++ b/apps/mobile/src/app/(tabs)/(home,search,collection,feed)/user/[username]/(follow)/_layout.tsx @@ -1,27 +1,18 @@ import { View } from '../../../../../../components/ui/view'; import tw from '../../../../../../lib/tw'; import { useTheme } from '../../../../../../providers/ThemeProvider'; -import { - createMaterialTopTabNavigator, - MaterialTopTabNavigationEventMap, - MaterialTopTabNavigationOptions, -} from 'expo-router/js-top-tabs'; -import { HeaderTitle, ParamListBase, TabNavigationState } from 'expo-router/react-navigation'; -import { Stack, useLocalSearchParams, withLayoutContext } from 'expo-router'; +import { TopTabs } from 'expo-router/js-top-tabs'; +import { HeaderTitle } from 'expo-router/react-navigation'; +import { Stack, useLocalSearchParams } from 'expo-router'; import { upperFirst } from 'lodash'; import { useTranslations } from 'use-intl'; import { Icons } from '../../../../../../constants/Icons'; import { useQuery } from '@tanstack/react-query'; import { userByUsernameOptions } from '@libs/query-client'; -const Tab = createMaterialTopTabNavigator(); - -const MaterialTopTabs = withLayoutContext< - MaterialTopTabNavigationOptions, - typeof Tab.Navigator, - TabNavigationState, - MaterialTopTabNavigationEventMap ->(Tab.Navigator); +export const unstable_settings = { + anchor: 'followers', +}; const ProfileFollowLayout = () => { const { username } = useLocalSearchParams<{ username: string }>(); @@ -42,8 +33,7 @@ const ProfileFollowLayout = () => { headerBackButtonDisplayMode: 'minimal', }} /> - { }, }} > - - - + ); }; diff --git a/apps/mobile/src/app/(tabs)/_layout.tsx b/apps/mobile/src/app/(tabs)/_layout.tsx index 152d301f..cd1c271f 100644 --- a/apps/mobile/src/app/(tabs)/_layout.tsx +++ b/apps/mobile/src/app/(tabs)/_layout.tsx @@ -4,7 +4,7 @@ import { useTheme } from '../../providers/ThemeProvider'; import { useTranslations } from 'use-intl'; import { upperFirst } from 'lodash'; import { useAppGates } from '../../hooks/gates/useAppGates'; -import { NativeTabs } from 'expo-router/unstable-native-tabs'; +import { NativeTabs } from 'expo-router/native-tabs'; import { isIOS } from '../../platform/detection'; const TabsLayout = () => { diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index d4741961..41474f97 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -21,6 +21,10 @@ import { useTranslations } from 'use-intl'; import { Platform } from 'react-native'; import { osName } from 'expo-device'; +export const unstable_settings = { + anchor: '(tabs)', +}; + export { ErrorBoundary } from '../providers/ErrorBoundaryProvider'; enableScreens(true); @@ -38,7 +42,7 @@ const RootLayoutNav = () => { const { defaultScreenOptions, isLiquidGlassAvailable } = useTheme(); useHomeWidgetsSync(); return ( - + { const t = useTranslations(); const { defaultScreenOptions } = useTheme(); return ( { {/* SUBMIT BUTTON */} diff --git a/apps/mobile/src/app/auth/(main)/signup.tsx b/apps/mobile/src/app/auth/(main)/signup.tsx index 5e367925..72a4d58e 100644 --- a/apps/mobile/src/app/auth/(main)/signup.tsx +++ b/apps/mobile/src/app/auth/(main)/signup.tsx @@ -411,7 +411,7 @@ const SignupScreen = () => { {/* SUBMIT BUTTON */} diff --git a/apps/mobile/src/app/reco/send/[type]/[id].tsx b/apps/mobile/src/app/reco/send/[type]/[id].tsx index 1d0fb519..9f121478 100644 --- a/apps/mobile/src/app/reco/send/[type]/[id].tsx +++ b/apps/mobile/src/app/reco/send/[type]/[id].tsx @@ -307,7 +307,7 @@ const RecoSend = () => { disabled={!canSave || isSendingReco} variant="outline" size="lg" - onPress={form.handleSubmit(handleSubmit)} + onPress={() => void form.handleSubmit(handleSubmit)()} > {upperFirst(t('common.messages.send'))} diff --git a/apps/mobile/src/app/settings/account.tsx b/apps/mobile/src/app/settings/account.tsx index db9f781a..9be98f08 100644 --- a/apps/mobile/src/app/settings/account.tsx +++ b/apps/mobile/src/app/settings/account.tsx @@ -217,7 +217,7 @@ const SettingsAccountScreen = () => { variant="ghost" size="fit" loading={isLoading} - onPress={form.handleSubmit(handleOnSubmit)} + onPress={() => void form.handleSubmit(handleOnSubmit)()} disabled={!hasUnsavedChanges || !form.formState.isValid || isLoading} > {upperFirst(t('common.messages.save'))} @@ -227,7 +227,7 @@ const SettingsAccountScreen = () => { { type: 'button', label: upperFirst(t('common.messages.save')), - onPress: form.handleSubmit(handleOnSubmit), + onPress: () => void form.handleSubmit(handleOnSubmit)(), tintColor: props.tintColor, disabled: !hasUnsavedChanges || !form.formState.isValid || isLoading, icon: { diff --git a/apps/mobile/src/app/settings/appearance.tsx b/apps/mobile/src/app/settings/appearance.tsx index 5c9ad64e..d97844b8 100644 --- a/apps/mobile/src/app/settings/appearance.tsx +++ b/apps/mobile/src/app/settings/appearance.tsx @@ -91,7 +91,7 @@ const SettingsAppearanceScreen = () => { variant="ghost" size="fit" loading={isLoading} - onPress={form.handleSubmit(handleSubmit)} + onPress={() => void form.handleSubmit(handleSubmit)()} disabled={!form.formState.isDirty || !form.formState.isValid || isLoading} > {upperFirst(t('common.messages.save'))} @@ -101,7 +101,7 @@ const SettingsAppearanceScreen = () => { { type: 'button', label: upperFirst(t('common.messages.save')), - onPress: form.handleSubmit(handleSubmit), + onPress: () => void form.handleSubmit(handleSubmit)(), tintColor: props.tintColor, disabled: !form.formState.isDirty || !form.formState.isValid || isLoading, icon: { diff --git a/apps/mobile/src/app/settings/data/(main)/_layout.tsx b/apps/mobile/src/app/settings/data/(main)/_layout.tsx index 1ce1656a..bbfdf3fb 100644 --- a/apps/mobile/src/app/settings/data/(main)/_layout.tsx +++ b/apps/mobile/src/app/settings/data/(main)/_layout.tsx @@ -1,11 +1,5 @@ -import { - createMaterialTopTabNavigator, - MaterialTopTabBarProps, - MaterialTopTabNavigationEventMap, - MaterialTopTabNavigationOptions, -} from 'expo-router/js-top-tabs'; -import { ParamListBase, TabNavigationState } from 'expo-router/react-navigation'; -import { Stack, usePathname, useRouter, withLayoutContext } from 'expo-router'; +import { MaterialTopTabBarProps, TopTabs } from 'expo-router/js-top-tabs'; +import { Stack, usePathname, useRouter } from 'expo-router'; import { upperFirst } from 'lodash'; import { useTranslations } from 'use-intl'; import { SegmentedControlTabBar } from '../../../../components/ui/segmented-control-tabbar'; @@ -14,14 +8,9 @@ import { Icons } from '../../../../constants/Icons'; import tw from '../../../../lib/tw'; import { useMemo } from 'react'; -const Tab = createMaterialTopTabNavigator(); - -const MaterialTopTabs = withLayoutContext< - MaterialTopTabNavigationOptions, - typeof Tab.Navigator, - TabNavigationState, - MaterialTopTabNavigationEventMap ->(Tab.Navigator); +export const unstable_settings = { + anchor: 'imports', +}; const SettingsDataLayout = ({ segment }: { segment: string }) => { const t = useTranslations(); @@ -67,19 +56,16 @@ const SettingsDataLayout = ({ segment }: { segment: string }) => { : [], }} /> - } - > - }> + - - + ); }; diff --git a/apps/mobile/src/app/settings/profile.tsx b/apps/mobile/src/app/settings/profile.tsx index 094a87ca..5035e436 100644 --- a/apps/mobile/src/app/settings/profile.tsx +++ b/apps/mobile/src/app/settings/profile.tsx @@ -236,7 +236,7 @@ const SettingsProfileScreen = () => { variant="ghost" size="fit" loading={isPending} - onPress={form.handleSubmit(handleSubmit)} + onPress={() => void form.handleSubmit(handleSubmit)()} disabled={!canSave || isPending} > {upperFirst(t('common.messages.save'))} @@ -246,7 +246,7 @@ const SettingsProfileScreen = () => { { type: 'button', label: upperFirst(t('common.messages.save')), - onPress: form.handleSubmit(handleSubmit), + onPress: () => void form.handleSubmit(handleSubmit)(), tintColor: props.tintColor, disabled: !canSave || isPending, icon: { diff --git a/apps/mobile/src/app/settings/security.tsx b/apps/mobile/src/app/settings/security.tsx index 9f471bff..8e1df2ae 100644 --- a/apps/mobile/src/app/settings/security.tsx +++ b/apps/mobile/src/app/settings/security.tsx @@ -120,7 +120,7 @@ const SettingsSecurityScreen = () => { variant="ghost" size="fit" loading={isLoading} - onPress={form.handleSubmit(handleSubmit)} + onPress={() => void form.handleSubmit(handleSubmit)()} disabled={!form.formState.isValid || isLoading} > {upperFirst(t('common.messages.save'))} @@ -130,7 +130,7 @@ const SettingsSecurityScreen = () => { { type: 'button', label: upperFirst(t('common.messages.save')), - onPress: form.handleSubmit(handleSubmit), + onPress: () => void form.handleSubmit(handleSubmit)(), tintColor: props.tintColor, disabled: !form.formState.isValid || isLoading, icon: { diff --git a/apps/mobile/src/components/bottom-sheets/sheets/BottomSheetBookmarkComment.tsx b/apps/mobile/src/components/bottom-sheets/sheets/BottomSheetBookmarkComment.tsx index f8b8aba3..8b3367bf 100644 --- a/apps/mobile/src/components/bottom-sheets/sheets/BottomSheetBookmarkComment.tsx +++ b/apps/mobile/src/components/bottom-sheets/sheets/BottomSheetBookmarkComment.tsx @@ -136,7 +136,7 @@ export const BottomSheetBookmarkComment = forwardRef< />