Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
ios: {
deploymentTarget: '16.4',
useFrameworks: 'static',
enableSceneSupport: true,
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Stack initialRouteName={initialRouteName} screenOptions={defaultScreenOptions}>
<Stack screenOptions={defaultScreenOptions}>
<Stack.Protected guard={!!user}>
<Stack.Screen
name="feed"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { Button } from '../../../../../components/ui/Button';
import { UserNav } from '../../../../../components/user/UserNav';
import tw from '../../../../../lib/tw';
import {
createMaterialTopTabNavigator,
MaterialTopTabBarProps,
MaterialTopTabNavigationEventMap,
MaterialTopTabNavigationOptions,
} from 'expo-router/js-top-tabs';
import { HeaderTitle, ParamListBase, TabNavigationState } from 'expo-router/react-navigation';
import { Stack, useRouter, withLayoutContext } from 'expo-router';
import { MaterialTopTabBarProps, TopTabs } from 'expo-router/js-top-tabs';
import { HeaderTitle } from 'expo-router/react-navigation';
import { Stack, useRouter } from 'expo-router';
import { upperFirst } from 'lodash';
import { useCallback } from 'react';
import { View, Pressable } from 'react-native';
Expand All @@ -21,15 +16,6 @@ import BottomSheetPlaylistCreate from '../../../../../components/bottom-sheets/s
import { Icons } from '../../../../../constants/Icons';
import { SegmentedControlTabBar } from '../../../../../components/ui/segmented-control-tabbar';

const Tab = createMaterialTopTabNavigator();

const MaterialTopTabs = withLayoutContext<
MaterialTopTabNavigationOptions,
typeof Tab.Navigator,
TabNavigationState<ParamListBase>,
MaterialTopTabNavigationEventMap
>(Tab.Navigator);

const CollectionLayout = () => {
const t = useTranslations();
const router = useRouter();
Expand Down Expand Up @@ -136,17 +122,15 @@ const CollectionLayout = () => {
],
}}
/>
<MaterialTopTabs
tabBar={(props: MaterialTopTabBarProps) => <SegmentedControlTabBar {...props} />}
>
<MaterialTopTabs.Screen name="index" options={{ title: 'perso' }} />
<MaterialTopTabs.Screen
<TopTabs tabBar={(props: MaterialTopTabBarProps) => <SegmentedControlTabBar {...props} />}>
<TopTabs.Screen name="index" options={{ title: 'perso' }} />
<TopTabs.Screen
name="saved"
options={{
title: upperFirst(t('common.messages.saved', { gender: 'female', count: 2 })),
}}
/>
</MaterialTopTabs>
</TopTabs>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ParamListBase>,
MaterialTopTabNavigationEventMap
>(Tab.Navigator);
export const unstable_settings = {
anchor: 'index',
};

const FeedLayout = () => {
const t = useTranslations();
return (
<MaterialTopTabs
initialRouteName="index"
tabBar={(props: MaterialTopTabBarProps) => <SegmentedControlTabBar {...props} />}
>
<MaterialTopTabs.Screen
<TopTabs tabBar={(props: MaterialTopTabBarProps) => <SegmentedControlTabBar {...props} />}>
<TopTabs.Screen
name="index"
options={{ title: upperFirst(t('common.messages.community')) }}
/>
<MaterialTopTabs.Screen
<TopTabs.Screen
name="persons"
options={{ title: upperFirst(t('common.messages.cast_and_crew')) }}
/>
</MaterialTopTabs>
</TopTabs>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -79,7 +83,7 @@ const SearchLayout = () => {
...headerSearchBar,
}}
/>
<Stack initialRouteName="(tabs)" />
<Stack />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ParamListBase>,
MaterialTopTabNavigationEventMap
>(Tab.Navigator);
export const unstable_settings = {
anchor: 'followers',
};

const ProfileFollowLayout = () => {
const { username } = useLocalSearchParams<{ username: string }>();
Expand All @@ -42,8 +33,7 @@ const ProfileFollowLayout = () => {
headerBackButtonDisplayMode: 'minimal',
}}
/>
<MaterialTopTabs
initialRouteName="followers"
<TopTabs
screenOptions={{
tabBarIndicatorStyle: {
backgroundColor: colors.accentBlue,
Expand All @@ -56,25 +46,23 @@ const ProfileFollowLayout = () => {
},
}}
>
<MaterialTopTabs.Screen
<TopTabs.Screen
name="followers"
initialParams={{ username }}
options={{
title: upperFirst(
t('common.messages.follower_count', { count: profile?.followersCount || 0 }),
),
}}
/>
<MaterialTopTabs.Screen
<TopTabs.Screen
name="followees"
initialParams={{ username }}
options={{
title: upperFirst(
t('common.messages.followee_count', { count: profile?.followingCount || 0 }),
),
}}
/>
</MaterialTopTabs>
</TopTabs>
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
6 changes: 5 additions & 1 deletion apps/mobile/src/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -38,7 +42,7 @@ const RootLayoutNav = () => {
const { defaultScreenOptions, isLiquidGlassAvailable } = useTheme();
useHomeWidgetsSync();
return (
<Stack initialRouteName="(tabs)" screenOptions={defaultScreenOptions}>
<Stack screenOptions={defaultScreenOptions}>
<Stack.Protected guard={isUpdateRequired}>
<Stack.Screen
name="update-required"
Expand Down
5 changes: 4 additions & 1 deletion apps/mobile/src/app/auth/(main)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { Stack } from 'expo-router';
import { upperFirst } from 'lodash';
import { useTranslations } from 'use-intl';

export const unstable_settings = {
anchor: 'index',
};

const AuthLayout = () => {
const t = useTranslations();
const { defaultScreenOptions } = useTheme();
return (
<Stack
initialRouteName="index"
screenOptions={{
...defaultScreenOptions,
headerTransparent: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/app/auth/(main)/login/otp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const LoginOtpScreen = () => {
{/* SUBMIT BUTTON */}
<Button
loading={isLoading}
onPress={form.handleSubmit(handleSubmit)}
onPress={() => void form.handleSubmit(handleSubmit)()}
style={tw`w-full rounded-xl`}
>
{t('pages.auth.login.otp.form.submit')}
Expand Down Expand Up @@ -231,7 +231,7 @@ const LoginOtpScreen = () => {
variant="ghost"
style={tw`p-0`}
disabled={isLoading}
onPress={form.handleSubmit(handleSubmit)}
onPress={() => void form.handleSubmit(handleSubmit)()}
>
{t('common.form.resend_code')}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/auth/(main)/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ const SignupScreen = () => {
</GroupedInput>
{/* SUBMIT BUTTON */}
<Button
onPress={form.handleSubmit(handleSubmit)}
onPress={() => void form.handleSubmit(handleSubmit)()}
loading={isLoading}
style={tw.style('w-full rounded-xl')}
>
Expand Down
5 changes: 4 additions & 1 deletion apps/mobile/src/app/auth/(password)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { useTheme } from '../../../providers/ThemeProvider';
import { Stack } from 'expo-router';
import { useTranslations } from 'use-intl';

export const unstable_settings = {
anchor: 'forgot-password',
};

const AuthPasswordLayout = () => {
const { defaultScreenOptions } = useTheme();
const t = useTranslations();
return (
<>
<Stack
initialRouteName="forgot-password"
screenOptions={{
...defaultScreenOptions,
headerTransparent: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/app/playlist/[playlist_id]/edit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const ModalPlaylistEdit = () => {
variant="ghost"
size="fit"
loading={isPending}
onPress={form.handleSubmit(handleSubmit)}
onPress={() => void form.handleSubmit(handleSubmit)()}
disabled={!canSave || isPending}
>
{upperFirst(t('common.messages.save'))}
Expand All @@ -284,7 +284,7 @@ const ModalPlaylistEdit = () => {
{
type: 'button',
label: upperFirst(t('common.messages.save')),
onPress: form.handleSubmit(handleSubmit),
onPress: () => void form.handleSubmit(handleSubmit)(),
tintColor: props.tintColor,
disabled: !canSave || isPending,
icon: {
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/playlist/add/[type]/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const PlaylistAddTo = () => {
disabled={!canSave || isAddingToPlaylist}
variant="outline"
size="lg"
onPress={form.handleSubmit(handleSubmit)}
onPress={() => void form.handleSubmit(handleSubmit)()}
>
{upperFirst(t('common.messages.add', { count: selected.length }))}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/app/reco/send/[type]/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'))}
</Button>
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/app/settings/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'))}
Expand All @@ -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: {
Expand Down
Loading