@openpeepshq/rn-components 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -10
- package/src/components/custom/common/index.ts +0 -1
- package/src/components/custom/index.ts +0 -1
- package/src/components/index.ts +1 -0
- package/src/components/jams/CreateNewJam.tsx +11 -10
- package/src/components/layout/AuthLayout.tsx +120 -0
- package/src/components/layout/ContentHeader.tsx +62 -0
- package/src/components/layout/HeaderActionButton.tsx +23 -0
- package/src/components/layout/HeaderMobile.tsx +96 -0
- package/src/components/layout/PlusButton.tsx +26 -0
- package/src/components/layout/RootLayout.tsx +30 -0
- package/src/components/layout/index.ts +13 -0
- package/src/components/layout/pageChrome.test.tsx +147 -0
- package/src/components/layout/pageChrome.tsx +110 -0
- package/src/components/navigation/auth-navigator.tsx +2 -2
- package/src/components/navigation/main-navigator.tsx +17 -1
- package/src/components/navigation/tab-navigator.tsx +2 -0
- package/src/components/post/NewEventButton.tsx +23 -16
- package/src/components/post/NewNoteButton.tsx +15 -13
- package/src/pages/About.tsx +3 -5
- package/src/pages/CodeOfConduct.tsx +7 -7
- package/src/pages/Explore.tsx +87 -127
- package/src/pages/Members.tsx +31 -39
- package/src/pages/Notifications.tsx +6 -13
- package/src/pages/PostDetail.tsx +12 -16
- package/src/pages/Profile.tsx +3 -2
- package/src/pages/Tags.tsx +74 -16
- package/src/pages/Welcome.tsx +3 -8
- package/src/pages/articles/Edit.tsx +18 -15
- package/src/pages/articles/Index.tsx +11 -21
- package/src/pages/articles/New.tsx +18 -15
- package/src/pages/conversations/Index.tsx +44 -68
- package/src/pages/conversations/Info.tsx +6 -5
- package/src/pages/conversations/New.tsx +14 -13
- package/src/pages/conversations/NewDraft.tsx +5 -5
- package/src/pages/conversations/Show.tsx +16 -20
- package/src/pages/events/Edit.tsx +14 -13
- package/src/pages/events/Index.tsx +28 -32
- package/src/pages/events/My.tsx +7 -7
- package/src/pages/events/New.tsx +14 -13
- package/src/pages/feeds/Bookmarks.tsx +3 -9
- package/src/pages/feeds/Local.tsx +3 -10
- package/src/pages/feeds/My.tsx +3 -9
- package/src/pages/groups/Edit.tsx +6 -7
- package/src/pages/groups/EditInfo.tsx +20 -17
- package/src/pages/groups/EditRoles.tsx +18 -19
- package/src/pages/groups/Index.tsx +82 -119
- package/src/pages/groups/Info.tsx +22 -23
- package/src/pages/groups/Members.tsx +9 -8
- package/src/pages/groups/New.tsx +18 -15
- package/src/pages/groups/Show.tsx +6 -5
- package/src/pages/jams/Index.tsx +8 -26
- package/src/pages/jams/New.tsx +14 -11
- package/src/pages/posts/Edit.tsx +20 -17
- package/src/pages/posts/New.tsx +30 -29
- package/src/pages/posts/Reply.tsx +20 -16
- package/src/pages/profile/Followers.tsx +9 -10
- package/src/pages/profile/Following.tsx +9 -10
- package/src/pages/settings/AccessTokens.tsx +6 -5
- package/src/pages/settings/Account.tsx +13 -12
- package/src/pages/settings/Blocked.tsx +5 -5
- package/src/pages/settings/Feed.tsx +13 -12
- package/src/pages/settings/Index.tsx +4 -24
- package/src/pages/settings/Language.tsx +36 -37
- package/src/pages/settings/NotificationPreferences.tsx +10 -12
- package/src/pages/settings/Notifications.tsx +10 -9
- package/src/pages/settings/PublicProfile.tsx +6 -6
- package/src/pages/settings/PushEnabledDevices.tsx +10 -9
- package/src/pages/settings/Theme.tsx +13 -12
- package/src/pages/settings/Timezone.tsx +27 -28
- package/src/components/custom/common/plus-fab.tsx +0 -23
- package/src/components/custom/headers/generic-header.tsx +0 -103
- package/src/components/custom/headers/index.ts +0 -2
- package/src/components/custom/headers/tab-screens-header.tsx +0 -206
- package/src/components/navigation/auth-wrapper.tsx +0 -107
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useLayoutEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
export type PlusButtonAction = {
|
|
11
|
+
action: string | (() => Promise<unknown> | unknown);
|
|
12
|
+
title?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type PlusButtonActions =
|
|
16
|
+
| PlusButtonAction
|
|
17
|
+
| PlusButtonAction[]
|
|
18
|
+
| undefined;
|
|
19
|
+
|
|
20
|
+
export type PageHeaderValue = {
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
actions?: ReactNode;
|
|
23
|
+
onBack?: () => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type PageChromeSetters = {
|
|
27
|
+
setHeader: (header: PageHeaderValue | undefined) => void;
|
|
28
|
+
setPlus: (plus: PlusButtonActions) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type PageChromeValues = {
|
|
32
|
+
header: PageHeaderValue | undefined;
|
|
33
|
+
plus: PlusButtonActions;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Stable setters context. Its value never changes, so components that call
|
|
38
|
+
* `useSetPageHeader` / `useSetPlusButtonActions` are not re-rendered when
|
|
39
|
+
* the chrome values change. Keeping the setters out of the value context is
|
|
40
|
+
* what prevents infinite update loops ("Maximum update depth exceeded") for
|
|
41
|
+
* pages that register a fresh, non-memoized header element or plus-actions
|
|
42
|
+
* object on every render.
|
|
43
|
+
*/
|
|
44
|
+
const PageChromeSettersContext = createContext<PageChromeSetters | null>(null);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Chrome values context. Its value changes whenever the header or plus
|
|
48
|
+
* actions change, so it must only be consumed by display components
|
|
49
|
+
* (header/plus button) — never by a component that registers the values.
|
|
50
|
+
*/
|
|
51
|
+
const PageChromeValuesContext = createContext<PageChromeValues | null>(null);
|
|
52
|
+
|
|
53
|
+
const MISSING_CHROME_ERROR = 'Page chrome hooks must be used within RootLayout';
|
|
54
|
+
|
|
55
|
+
export const PageChromeProvider = ({ children }: { children: ReactNode }) => {
|
|
56
|
+
const [header, setHeader] = useState<PageHeaderValue | undefined>();
|
|
57
|
+
const [plus, setPlus] = useState<PlusButtonActions>(undefined);
|
|
58
|
+
// useState setters are stable, so this value is created exactly once.
|
|
59
|
+
const setters = useMemo(() => ({ setHeader, setPlus }), [setHeader, setPlus]);
|
|
60
|
+
const values = useMemo(() => ({ header, plus }), [header, plus]);
|
|
61
|
+
return (
|
|
62
|
+
<PageChromeSettersContext.Provider value={setters}>
|
|
63
|
+
<PageChromeValuesContext.Provider value={values}>
|
|
64
|
+
{children}
|
|
65
|
+
</PageChromeValuesContext.Provider>
|
|
66
|
+
</PageChromeSettersContext.Provider>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const useSetters = () => {
|
|
71
|
+
const ctx = useContext(PageChromeSettersContext);
|
|
72
|
+
if (!ctx) {
|
|
73
|
+
throw new Error(MISSING_CHROME_ERROR);
|
|
74
|
+
}
|
|
75
|
+
return ctx;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const useValues = () => {
|
|
79
|
+
const ctx = useContext(PageChromeValuesContext);
|
|
80
|
+
if (!ctx) {
|
|
81
|
+
throw new Error(MISSING_CHROME_ERROR);
|
|
82
|
+
}
|
|
83
|
+
return ctx;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const usePageChrome = () => {
|
|
87
|
+
const values = useValues();
|
|
88
|
+
const setters = useSetters();
|
|
89
|
+
return { ...values, ...setters };
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const useSetPageHeader = (
|
|
93
|
+
title?: ReactNode,
|
|
94
|
+
actions?: ReactNode,
|
|
95
|
+
onBack?: () => void
|
|
96
|
+
) => {
|
|
97
|
+
const { setHeader } = useSetters();
|
|
98
|
+
useLayoutEffect(() => {
|
|
99
|
+
setHeader({ title, actions, onBack });
|
|
100
|
+
return () => setHeader(undefined);
|
|
101
|
+
}, [actions, onBack, setHeader, title]);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const useSetPlusButtonActions = (actions: PlusButtonActions) => {
|
|
105
|
+
const { setPlus } = useSetters();
|
|
106
|
+
useLayoutEffect(() => {
|
|
107
|
+
setPlus(actions);
|
|
108
|
+
return () => setPlus(undefined);
|
|
109
|
+
}, [actions, setPlus]);
|
|
110
|
+
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ResetPassword,
|
|
13
13
|
} from '../../pages';
|
|
14
14
|
import { AUTH_ROUTES } from './types';
|
|
15
|
-
import {
|
|
15
|
+
import { AuthLayout } from '../layout';
|
|
16
16
|
|
|
17
17
|
const Stack = createNativeStackNavigator<AuthStackParamList>();
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ export const AuthNavigator = () => {
|
|
|
20
20
|
return (
|
|
21
21
|
<Stack.Navigator
|
|
22
22
|
screenOptions={{ headerShown: false, animation: 'fade' }}
|
|
23
|
-
screenLayout={({ children }) => <
|
|
23
|
+
screenLayout={({ children }) => <AuthLayout>{children}</AuthLayout>}
|
|
24
24
|
>
|
|
25
25
|
<Stack.Screen name={AUTH_ROUTES.WELCOME} component={AuthWelcome} />
|
|
26
26
|
<Stack.Screen name={AUTH_ROUTES.LOGIN} component={Login} />
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from '../../pages';
|
|
45
45
|
import { MenuWrapper } from './side-menu-wrapper';
|
|
46
46
|
import { SideMenuDrawer } from './side-menu-drawer';
|
|
47
|
+
import { RootLayout } from '../layout';
|
|
47
48
|
|
|
48
49
|
import { MainStackParamList } from './types';
|
|
49
50
|
import { useWindowSize } from '../../hooks/index';
|
|
@@ -52,6 +53,14 @@ import { useOpenpeeps } from '@openpeepshq/react';
|
|
|
52
53
|
|
|
53
54
|
const Stack = createNativeStackNavigator<MainStackParamList>();
|
|
54
55
|
|
|
56
|
+
const NO_ROOT_LAYOUT = new Set([
|
|
57
|
+
'TabNavigator',
|
|
58
|
+
'JamSession',
|
|
59
|
+
'VideoPlayer',
|
|
60
|
+
'About',
|
|
61
|
+
'CodeOfConduct',
|
|
62
|
+
]);
|
|
63
|
+
|
|
55
64
|
export const MainNavigator = () => {
|
|
56
65
|
const { openpeepsApi, queryClient } = useOpenpeeps();
|
|
57
66
|
queryClient.setDefaultOptions({
|
|
@@ -90,7 +99,14 @@ export const MainNavigator = () => {
|
|
|
90
99
|
return (
|
|
91
100
|
<Stack.Navigator
|
|
92
101
|
screenOptions={{ headerShown: false, animation: 'fade' }}
|
|
93
|
-
screenLayout={({ children }) =>
|
|
102
|
+
screenLayout={({ children, route }) => {
|
|
103
|
+
const body = NO_ROOT_LAYOUT.has(route.name) ? (
|
|
104
|
+
children
|
|
105
|
+
) : (
|
|
106
|
+
<RootLayout>{children}</RootLayout>
|
|
107
|
+
);
|
|
108
|
+
return <Wrapper>{body}</Wrapper>;
|
|
109
|
+
}}
|
|
94
110
|
>
|
|
95
111
|
<Stack.Screen name="TabNavigator" component={TabNavigator} />
|
|
96
112
|
<Stack.Screen name="Profile" component={Profile} />
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
useServerInfo,
|
|
37
37
|
} from '@openpeepshq/react';
|
|
38
38
|
import { useOpenPeepsTheme } from '../../theme/OpenPeepsThemeProvider';
|
|
39
|
+
import { RootLayout } from '../layout';
|
|
39
40
|
|
|
40
41
|
const Tab = createBottomTabNavigator<TabStackParamList>();
|
|
41
42
|
|
|
@@ -91,6 +92,7 @@ export const TabNavigator = () => {
|
|
|
91
92
|
const display = isMediumScreenOrLarger ? 'none' : 'flex';
|
|
92
93
|
return (
|
|
93
94
|
<Tab.Navigator
|
|
95
|
+
screenLayout={({ children }) => <RootLayout>{children}</RootLayout>}
|
|
94
96
|
screenOptions={({ route }) => ({
|
|
95
97
|
headerShown: false,
|
|
96
98
|
tabBarShowLabel: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useNavigation } from '@react-navigation/native';
|
|
4
4
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
type VisibilityType,
|
|
10
10
|
} from '@openpeepshq/common';
|
|
11
11
|
import { getNewPostStores, useAuthData } from '@openpeepshq/react';
|
|
12
|
-
import {
|
|
13
|
-
import { PlusIcon } from '../icons/index';
|
|
12
|
+
import { useSetPlusButtonActions } from '../layout';
|
|
14
13
|
import { MainStackParamList } from '../navigation/types/index';
|
|
15
14
|
|
|
16
15
|
export interface NewEventButtonProps {
|
|
@@ -19,7 +18,7 @@ export interface NewEventButtonProps {
|
|
|
19
18
|
group?: GroupWithMeta;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
/**
|
|
21
|
+
/** Registers the RootLayout plus button for creating an event. */
|
|
23
22
|
export const NewEventButton = ({
|
|
24
23
|
visibility,
|
|
25
24
|
currentProfile,
|
|
@@ -34,17 +33,25 @@ export const NewEventButton = ({
|
|
|
34
33
|
const canPost =
|
|
35
34
|
!!profile && canCreatePost(authData, 'event', visibility, group);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
const plusActions = useMemo(
|
|
37
|
+
() =>
|
|
38
|
+
canPost
|
|
39
|
+
? {
|
|
40
|
+
title: t('events.form.title'),
|
|
41
|
+
action: () => {
|
|
42
|
+
const stores = getNewPostStores();
|
|
43
|
+
stores.event = {
|
|
44
|
+
...stores.event,
|
|
45
|
+
visibility,
|
|
46
|
+
groupId: group?.id,
|
|
47
|
+
};
|
|
48
|
+
navigation.navigate('NewEvent');
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
: undefined,
|
|
52
|
+
[canPost, group?.id, navigation, t, visibility]
|
|
49
53
|
);
|
|
54
|
+
|
|
55
|
+
useSetPlusButtonActions(plusActions);
|
|
56
|
+
return null;
|
|
50
57
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import {
|
|
4
4
|
canCreatePost,
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
type VisibilityType,
|
|
8
8
|
} from '@openpeepshq/common';
|
|
9
9
|
import { useAuthData } from '@openpeepshq/react';
|
|
10
|
-
import {
|
|
11
|
-
import { PencilLineIcon } from '../icons/index';
|
|
10
|
+
import { useSetPlusButtonActions } from '../layout';
|
|
12
11
|
import { useNewPostModal } from './post-form/NewPostModalContext';
|
|
13
12
|
|
|
14
13
|
export interface NewNoteButtonProps {
|
|
@@ -17,7 +16,7 @@ export interface NewNoteButtonProps {
|
|
|
17
16
|
group?: GroupWithMeta;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
/**
|
|
19
|
+
/** Registers the RootLayout plus button for creating a note. */
|
|
21
20
|
export const NewNoteButton = ({
|
|
22
21
|
visibility,
|
|
23
22
|
currentProfile,
|
|
@@ -31,14 +30,17 @@ export const NewNoteButton = ({
|
|
|
31
30
|
const canPost =
|
|
32
31
|
!!profile && canCreatePost(authData, 'note', visibility, group);
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const plusActions = useMemo(
|
|
34
|
+
() =>
|
|
35
|
+
canPost
|
|
36
|
+
? {
|
|
37
|
+
title: t('posts.form.title'),
|
|
38
|
+
action: () => openNewPost({ visibility, group }),
|
|
39
|
+
}
|
|
40
|
+
: undefined,
|
|
41
|
+
[canPost, group, openNewPost, t, visibility]
|
|
43
42
|
);
|
|
43
|
+
|
|
44
|
+
useSetPlusButtonActions(plusActions);
|
|
45
|
+
return null;
|
|
44
46
|
};
|
package/src/pages/About.tsx
CHANGED
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { ScrollView } from 'react-native';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useCommunityInfoPages } from '@openpeepshq/react';
|
|
5
|
-
import {
|
|
5
|
+
import { AuthLayout } from '../components/layout';
|
|
6
6
|
import { OpenpeepsMarkdown } from '../components/markdown/index';
|
|
7
7
|
import { MainScreenProps } from '../components/navigation/types/index';
|
|
8
|
-
import { ThemedSafeAreaView } from '../components/ui/themed-safe-area-view';
|
|
9
8
|
import { ThemedText } from '../components/ui/themed-text';
|
|
10
9
|
|
|
11
10
|
export const About: React.FC<MainScreenProps<'About'>> = () => {
|
|
@@ -13,8 +12,7 @@ export const About: React.FC<MainScreenProps<'About'>> = () => {
|
|
|
13
12
|
const { communityName, aboutPage } = useCommunityInfoPages();
|
|
14
13
|
|
|
15
14
|
return (
|
|
16
|
-
<
|
|
17
|
-
<GenericHeader title={t('navigation.about', { defaultValue: 'About' })} />
|
|
15
|
+
<AuthLayout noRedirect>
|
|
18
16
|
<ScrollView contentContainerClassName="p-4 pb-12">
|
|
19
17
|
<ThemedText className="text-2xl font-bold pb-4">
|
|
20
18
|
{t('about.welcomeTo', {
|
|
@@ -24,6 +22,6 @@ export const About: React.FC<MainScreenProps<'About'>> = () => {
|
|
|
24
22
|
</ThemedText>
|
|
25
23
|
<OpenpeepsMarkdown source={aboutPage} />
|
|
26
24
|
</ScrollView>
|
|
27
|
-
</
|
|
25
|
+
</AuthLayout>
|
|
28
26
|
);
|
|
29
27
|
};
|
|
@@ -2,23 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import { ScrollView } from 'react-native';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useCommunityInfoPages } from '@openpeepshq/react';
|
|
5
|
-
import {
|
|
5
|
+
import { AuthLayout } from '../components/layout';
|
|
6
6
|
import { OpenpeepsMarkdown } from '../components/markdown/index';
|
|
7
7
|
import { MainScreenProps } from '../components/navigation/types/index';
|
|
8
|
-
import {
|
|
8
|
+
import { ThemedText } from '../components/ui/themed-text';
|
|
9
9
|
|
|
10
10
|
export const CodeOfConduct: React.FC<MainScreenProps<'CodeOfConduct'>> = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
const { codeOfConduct } = useCommunityInfoPages();
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<
|
|
16
|
-
<GenericHeader
|
|
17
|
-
title={t('codeOfConduct.title', { defaultValue: 'Code of conduct' })}
|
|
18
|
-
/>
|
|
15
|
+
<AuthLayout noRedirect>
|
|
19
16
|
<ScrollView contentContainerClassName="p-4 pb-12">
|
|
17
|
+
<ThemedText className="text-2xl font-bold pb-4">
|
|
18
|
+
{t('codeOfConduct.title', { defaultValue: 'Code of conduct' })}
|
|
19
|
+
</ThemedText>
|
|
20
20
|
<OpenpeepsMarkdown source={codeOfConduct} />
|
|
21
21
|
</ScrollView>
|
|
22
|
-
</
|
|
22
|
+
</AuthLayout>
|
|
23
23
|
);
|
|
24
24
|
};
|
package/src/pages/Explore.tsx
CHANGED
|
@@ -14,8 +14,8 @@ import { CompositeScreenProps } from '@react-navigation/native';
|
|
|
14
14
|
import {
|
|
15
15
|
EmptyStateContainer,
|
|
16
16
|
InfiniteScrollContainer,
|
|
17
|
-
TabScreensHeader,
|
|
18
17
|
} from '../components/custom/index';
|
|
18
|
+
import { useSetPageHeader } from '../components/layout';
|
|
19
19
|
import { ThemedText } from '../components/ui/themed-text';
|
|
20
20
|
import { useTranslation } from 'react-i18next';
|
|
21
21
|
import { Pressable, TouchableOpacity, View, ScrollView } from 'react-native';
|
|
@@ -58,139 +58,99 @@ export const Explore: React.FC<ExploreScreenProps> = ({ navigation }) => {
|
|
|
58
58
|
[currentProfile]
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
+
useSetPageHeader(
|
|
62
|
+
t('navigation.explore'),
|
|
63
|
+
isSearchToggled ? (
|
|
64
|
+
<View className="max-w-[200px] flex-row items-center">
|
|
65
|
+
<Input
|
|
66
|
+
className="flex-1"
|
|
67
|
+
placeholder={t('explore.searchPlaceholder', {
|
|
68
|
+
defaultValue: 'Search',
|
|
69
|
+
})}
|
|
70
|
+
value={searchQuery}
|
|
71
|
+
onChangeText={setSearchQuery}
|
|
72
|
+
/>
|
|
73
|
+
<TouchableOpacity
|
|
74
|
+
className="items-center justify-center px-2"
|
|
75
|
+
onPress={() => {
|
|
76
|
+
setSearchQuery('');
|
|
77
|
+
setIsSearchToggled(false);
|
|
78
|
+
setTabValue('landing');
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<XIcon size={20} className="text-foreground" />
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
</View>
|
|
84
|
+
) : (
|
|
85
|
+
<TouchableOpacity onPress={() => setIsSearchToggled(true)}>
|
|
86
|
+
<SearchIcon size={20} className="text-foreground" />
|
|
87
|
+
</TouchableOpacity>
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
|
|
61
91
|
return (
|
|
62
92
|
<ThemedView className="grow">
|
|
63
93
|
<Tabs
|
|
64
94
|
value={tabValue}
|
|
65
95
|
onValueChange={setTabValue}
|
|
66
|
-
className="w-full
|
|
96
|
+
className="mx-auto w-full flex-col gap-1.5"
|
|
67
97
|
>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
98
|
+
{isSearchToggled ? (
|
|
99
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
100
|
+
<TabsList className="flex-row w-full bg-transparent border-muted rounded-none border-b p-0">
|
|
101
|
+
<TabsTrigger
|
|
102
|
+
value="landing"
|
|
103
|
+
className="hidden"
|
|
104
|
+
onPress={() => setTabValue('hidden')}
|
|
105
|
+
/>
|
|
106
|
+
<TabsTrigger
|
|
107
|
+
value="members"
|
|
108
|
+
className={
|
|
109
|
+
tabValue === 'members' ? 'border-b-2 border-foreground' : ''
|
|
110
|
+
}
|
|
111
|
+
onPress={() => setTabValue('members')}
|
|
82
112
|
>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<ThemedText>Members</ThemedText>
|
|
127
|
-
</TabsTrigger>
|
|
128
|
-
<TabsTrigger
|
|
129
|
-
value="posts"
|
|
130
|
-
className={`${
|
|
131
|
-
tabValue === 'posts'
|
|
132
|
-
? 'border-b-2 border-foreground'
|
|
133
|
-
: ''
|
|
134
|
-
}`}
|
|
135
|
-
onPress={() => {
|
|
136
|
-
setTabValue('posts');
|
|
137
|
-
}}
|
|
138
|
-
>
|
|
139
|
-
<ThemedText>Posts</ThemedText>
|
|
140
|
-
</TabsTrigger>
|
|
141
|
-
<TabsTrigger
|
|
142
|
-
value="jams"
|
|
143
|
-
className={`${
|
|
144
|
-
tabValue === 'jams'
|
|
145
|
-
? 'border-b-2 border-foreground'
|
|
146
|
-
: ''
|
|
147
|
-
}`}
|
|
148
|
-
onPress={() => {
|
|
149
|
-
setTabValue('jams');
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
<ThemedText>Jams</ThemedText>
|
|
153
|
-
</TabsTrigger>
|
|
154
|
-
<TabsTrigger
|
|
155
|
-
value="events"
|
|
156
|
-
className={`${
|
|
157
|
-
tabValue === 'events'
|
|
158
|
-
? 'border-b-2 border-foreground'
|
|
159
|
-
: ''
|
|
160
|
-
}`}
|
|
161
|
-
onPress={() => {
|
|
162
|
-
setTabValue('events');
|
|
163
|
-
}}
|
|
164
|
-
>
|
|
165
|
-
<ThemedText>Events</ThemedText>
|
|
166
|
-
</TabsTrigger>
|
|
167
|
-
<TabsTrigger
|
|
168
|
-
value="groups"
|
|
169
|
-
className={`${
|
|
170
|
-
tabValue === 'groups'
|
|
171
|
-
? 'border-b-2 border-foreground'
|
|
172
|
-
: ''
|
|
173
|
-
}`}
|
|
174
|
-
onPress={() => {
|
|
175
|
-
setTabValue('groups');
|
|
176
|
-
}}
|
|
177
|
-
>
|
|
178
|
-
<ThemedText>Groups</ThemedText>
|
|
179
|
-
</TabsTrigger>
|
|
180
|
-
</TabsList>
|
|
181
|
-
</ScrollView>
|
|
182
|
-
</>
|
|
183
|
-
) : (
|
|
184
|
-
<>
|
|
185
|
-
<TouchableOpacity onPress={() => setIsSearchToggled(true)}>
|
|
186
|
-
<SearchIcon size={20} className="text-foreground" />
|
|
187
|
-
</TouchableOpacity>
|
|
188
|
-
</>
|
|
189
|
-
)}
|
|
190
|
-
</View>
|
|
191
|
-
</View>
|
|
192
|
-
}
|
|
193
|
-
/>
|
|
113
|
+
<ThemedText>Members</ThemedText>
|
|
114
|
+
</TabsTrigger>
|
|
115
|
+
<TabsTrigger
|
|
116
|
+
value="posts"
|
|
117
|
+
className={
|
|
118
|
+
tabValue === 'posts' ? 'border-b-2 border-foreground' : ''
|
|
119
|
+
}
|
|
120
|
+
onPress={() => setTabValue('posts')}
|
|
121
|
+
>
|
|
122
|
+
<ThemedText>Posts</ThemedText>
|
|
123
|
+
</TabsTrigger>
|
|
124
|
+
<TabsTrigger
|
|
125
|
+
value="jams"
|
|
126
|
+
className={
|
|
127
|
+
tabValue === 'jams' ? 'border-b-2 border-foreground' : ''
|
|
128
|
+
}
|
|
129
|
+
onPress={() => setTabValue('jams')}
|
|
130
|
+
>
|
|
131
|
+
<ThemedText>Jams</ThemedText>
|
|
132
|
+
</TabsTrigger>
|
|
133
|
+
<TabsTrigger
|
|
134
|
+
value="events"
|
|
135
|
+
className={
|
|
136
|
+
tabValue === 'events' ? 'border-b-2 border-foreground' : ''
|
|
137
|
+
}
|
|
138
|
+
onPress={() => setTabValue('events')}
|
|
139
|
+
>
|
|
140
|
+
<ThemedText>Events</ThemedText>
|
|
141
|
+
</TabsTrigger>
|
|
142
|
+
<TabsTrigger
|
|
143
|
+
value="groups"
|
|
144
|
+
className={
|
|
145
|
+
tabValue === 'groups' ? 'border-b-2 border-foreground' : ''
|
|
146
|
+
}
|
|
147
|
+
onPress={() => setTabValue('groups')}
|
|
148
|
+
>
|
|
149
|
+
<ThemedText>Groups</ThemedText>
|
|
150
|
+
</TabsTrigger>
|
|
151
|
+
</TabsList>
|
|
152
|
+
</ScrollView>
|
|
153
|
+
) : null}
|
|
194
154
|
<TabsContent
|
|
195
155
|
value="landing"
|
|
196
156
|
className="w-full flex h-64 items-center justify-center"
|