@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.
Files changed (75) hide show
  1. package/package.json +3 -10
  2. package/src/components/custom/common/index.ts +0 -1
  3. package/src/components/custom/index.ts +0 -1
  4. package/src/components/index.ts +1 -0
  5. package/src/components/jams/CreateNewJam.tsx +11 -10
  6. package/src/components/layout/AuthLayout.tsx +120 -0
  7. package/src/components/layout/ContentHeader.tsx +62 -0
  8. package/src/components/layout/HeaderActionButton.tsx +23 -0
  9. package/src/components/layout/HeaderMobile.tsx +96 -0
  10. package/src/components/layout/PlusButton.tsx +26 -0
  11. package/src/components/layout/RootLayout.tsx +30 -0
  12. package/src/components/layout/index.ts +13 -0
  13. package/src/components/layout/pageChrome.test.tsx +147 -0
  14. package/src/components/layout/pageChrome.tsx +110 -0
  15. package/src/components/navigation/auth-navigator.tsx +2 -2
  16. package/src/components/navigation/main-navigator.tsx +17 -1
  17. package/src/components/navigation/tab-navigator.tsx +2 -0
  18. package/src/components/post/NewEventButton.tsx +23 -16
  19. package/src/components/post/NewNoteButton.tsx +15 -13
  20. package/src/pages/About.tsx +3 -5
  21. package/src/pages/CodeOfConduct.tsx +7 -7
  22. package/src/pages/Explore.tsx +87 -127
  23. package/src/pages/Members.tsx +31 -39
  24. package/src/pages/Notifications.tsx +6 -13
  25. package/src/pages/PostDetail.tsx +12 -16
  26. package/src/pages/Profile.tsx +3 -2
  27. package/src/pages/Tags.tsx +74 -16
  28. package/src/pages/Welcome.tsx +3 -8
  29. package/src/pages/articles/Edit.tsx +18 -15
  30. package/src/pages/articles/Index.tsx +11 -21
  31. package/src/pages/articles/New.tsx +18 -15
  32. package/src/pages/conversations/Index.tsx +44 -68
  33. package/src/pages/conversations/Info.tsx +6 -5
  34. package/src/pages/conversations/New.tsx +14 -13
  35. package/src/pages/conversations/NewDraft.tsx +5 -5
  36. package/src/pages/conversations/Show.tsx +16 -20
  37. package/src/pages/events/Edit.tsx +14 -13
  38. package/src/pages/events/Index.tsx +28 -32
  39. package/src/pages/events/My.tsx +7 -7
  40. package/src/pages/events/New.tsx +14 -13
  41. package/src/pages/feeds/Bookmarks.tsx +3 -9
  42. package/src/pages/feeds/Local.tsx +3 -10
  43. package/src/pages/feeds/My.tsx +3 -9
  44. package/src/pages/groups/Edit.tsx +6 -7
  45. package/src/pages/groups/EditInfo.tsx +20 -17
  46. package/src/pages/groups/EditRoles.tsx +18 -19
  47. package/src/pages/groups/Index.tsx +82 -119
  48. package/src/pages/groups/Info.tsx +22 -23
  49. package/src/pages/groups/Members.tsx +9 -8
  50. package/src/pages/groups/New.tsx +18 -15
  51. package/src/pages/groups/Show.tsx +6 -5
  52. package/src/pages/jams/Index.tsx +8 -26
  53. package/src/pages/jams/New.tsx +14 -11
  54. package/src/pages/posts/Edit.tsx +20 -17
  55. package/src/pages/posts/New.tsx +30 -29
  56. package/src/pages/posts/Reply.tsx +20 -16
  57. package/src/pages/profile/Followers.tsx +9 -10
  58. package/src/pages/profile/Following.tsx +9 -10
  59. package/src/pages/settings/AccessTokens.tsx +6 -5
  60. package/src/pages/settings/Account.tsx +13 -12
  61. package/src/pages/settings/Blocked.tsx +5 -5
  62. package/src/pages/settings/Feed.tsx +13 -12
  63. package/src/pages/settings/Index.tsx +4 -24
  64. package/src/pages/settings/Language.tsx +36 -37
  65. package/src/pages/settings/NotificationPreferences.tsx +10 -12
  66. package/src/pages/settings/Notifications.tsx +10 -9
  67. package/src/pages/settings/PublicProfile.tsx +6 -6
  68. package/src/pages/settings/PushEnabledDevices.tsx +10 -9
  69. package/src/pages/settings/Theme.tsx +13 -12
  70. package/src/pages/settings/Timezone.tsx +27 -28
  71. package/src/components/custom/common/plus-fab.tsx +0 -23
  72. package/src/components/custom/headers/generic-header.tsx +0 -103
  73. package/src/components/custom/headers/index.ts +0 -2
  74. package/src/components/custom/headers/tab-screens-header.tsx +0 -206
  75. package/src/components/navigation/auth-wrapper.tsx +0 -107
@@ -2,11 +2,8 @@ import { useTranslation } from 'react-i18next';
2
2
  import { View, Pressable, ActivityIndicator } from 'react-native';
3
3
  import React, { useEffect } from 'react';
4
4
  import { ThemedView } from '../components/ui/themed-view';
5
- import {
6
- EmptyStateContainer,
7
- TabScreensHeader,
8
- } from '../components/custom/index';
9
- import { ThemedText } from '../components/ui/themed-text';
5
+ import { EmptyStateContainer } from '../components/custom/index';
6
+ import { useSetPageHeader } from '../components/layout';
10
7
  import {
11
8
  XIcon,
12
9
  SearchIcon,
@@ -52,42 +49,37 @@ export const Members: React.FC<DirectoryProps> = ({ navigation }) => {
52
49
  }
53
50
  }, [searchQuery, profiles, currentProfile]);
54
51
 
52
+ useSetPageHeader(
53
+ t('navigation.members'),
54
+ isSearchButtonClicked ? (
55
+ <View className="max-w-[200px] flex-row items-center">
56
+ <Input
57
+ className="flex-1"
58
+ placeholder={t('members.searchPlaceholder', {
59
+ defaultValue: 'Enter name or handle',
60
+ })}
61
+ value={searchQuery}
62
+ onChangeText={setSearchQuery}
63
+ />
64
+ <Pressable
65
+ className="items-center justify-center px-2"
66
+ onPress={() => {
67
+ setIsSearchButtonClicked(false);
68
+ setSearchQuery('');
69
+ }}
70
+ >
71
+ <XIcon className="text-foreground" />
72
+ </Pressable>
73
+ </View>
74
+ ) : (
75
+ <Pressable onPress={() => setIsSearchButtonClicked(true)}>
76
+ <SearchIcon className="text-foreground" />
77
+ </Pressable>
78
+ )
79
+ );
80
+
55
81
  return (
56
82
  <ThemedView className="grow">
57
- <TabScreensHeader
58
- children={
59
- <>
60
- {!isSearchButtonClicked ? (
61
- <View className="w-full flex flex-row justify-between items-center p-4">
62
- <ThemedText className="text-xl">
63
- {t('navigation.members')}
64
- </ThemedText>
65
- <Pressable onPress={() => setIsSearchButtonClicked(true)}>
66
- <SearchIcon className="text-foreground" />
67
- </Pressable>
68
- </View>
69
- ) : (
70
- <View className="w-full flex flex-row justify-between items-center p-4">
71
- <Input
72
- className="flex-1"
73
- placeholder="Enter name or handle"
74
- value={searchQuery}
75
- onChangeText={setSearchQuery}
76
- />
77
- <Pressable
78
- className=" w-[10%] flex justify-center items-center"
79
- onPress={() => {
80
- setIsSearchButtonClicked(false);
81
- setSearchQuery('');
82
- }}
83
- >
84
- <XIcon className="text-foreground" />
85
- </Pressable>
86
- </View>
87
- )}
88
- </>
89
- }
90
- />
91
83
  <KeyboardAwareScrollView className="relative w-full grow flex bg-background gap-y-4 border-t border-border p-2">
92
84
  {isLoading && <ActivityIndicator size={'small'} />}
93
85
  {filteredProfiles?.map((profile, index) => {
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- import { TabScreensHeader } from '../components/custom/index';
3
2
  import { ThemedView } from '../components/ui/themed-view';
4
- import { ThemedText } from '../components/ui/themed-text';
5
- import { View } from 'react-native';
6
3
  import { useOpenpeeps } from '@openpeepshq/react';
4
+ import { useSetPageHeader } from '../components/layout';
7
5
  import { useTranslation } from 'react-i18next';
8
6
  import {
9
7
  NotificationHeaderActions,
@@ -23,18 +21,13 @@ export const Notifications = () => {
23
21
  refetchFeed: () => query.refetch(),
24
22
  });
25
23
 
24
+ useSetPageHeader(
25
+ t('navigation.notifications'),
26
+ <NotificationHeaderActions />
27
+ );
28
+
26
29
  return (
27
30
  <ThemedView className="grow">
28
- <TabScreensHeader
29
- children={
30
- <View className="flex-row items-center justify-between">
31
- <ThemedText className="text-xl font-bold">
32
- {t('navigation.notifications')}
33
- </ThemedText>
34
- <NotificationHeaderActions />
35
- </View>
36
- }
37
- />
38
31
  <NotificationsList
39
32
  query={query}
40
33
  onRefresh={async () => {
@@ -3,8 +3,8 @@ import { RefreshControl } from 'react-native-gesture-handler';
3
3
  import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useOpenpeeps, usePostDetailTitle } from '@openpeepshq/react';
6
- import { GenericHeader } from '../components/custom/index';
7
- import { ThemedSafeAreaView } from '../components/ui/themed-safe-area-view';
6
+ import { useSetPageHeader } from '../components/layout';
7
+ import { ThemedView } from '../components/ui/themed-view';
8
8
  import { MainScreenProps } from '../components/navigation/types/index';
9
9
  import { goToParentOrBack } from '../components/navigation/parent-back';
10
10
  import { PostDetail as PostDetailComponent } from '../components/post/index';
@@ -38,20 +38,16 @@ export const PostDetail = ({ route, navigation }: PostProps) => {
38
38
  post,
39
39
  });
40
40
 
41
+ useSetPageHeader(
42
+ title,
43
+ post?.type === 'event' ? (
44
+ <FullEventActions post={post} occurrence={occurrence} />
45
+ ) : undefined,
46
+ handleGoBack
47
+ );
48
+
41
49
  return (
42
- <ThemedSafeAreaView className="flex-1">
43
- {post?.type === 'event' ? (
44
- <GenericHeader
45
- title={title}
46
- handleGoBack={handleGoBack}
47
- rightType="icon"
48
- rightButtonIcon={
49
- <FullEventActions post={post} occurrence={occurrence} />
50
- }
51
- />
52
- ) : (
53
- <GenericHeader title={title} handleGoBack={handleGoBack} />
54
- )}
50
+ <ThemedView className="flex-1">
55
51
  <KeyboardAwareScrollView
56
52
  className="w-full flex bg-background relative"
57
53
  refreshControl={
@@ -60,6 +56,6 @@ export const PostDetail = ({ route, navigation }: PostProps) => {
60
56
  >
61
57
  <PostDetailComponent postId={id} occurrence={occurrence} />
62
58
  </KeyboardAwareScrollView>
63
- </ThemedSafeAreaView>
59
+ </ThemedView>
64
60
  );
65
61
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ActivityIndicator, View } from 'react-native';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useCurrentProfile, useOpenpeeps } from '@openpeepshq/react';
5
- import { GenericHeader } from '../components/custom/index';
5
+ import { useSetPageHeader } from '../components/layout';
6
6
  import { RssIcon } from '../components/icons/index';
7
7
  import { MainScreenProps } from '../components/navigation/types/index';
8
8
  import {
@@ -36,9 +36,10 @@ export const Profile = ({ route }: ProfileProps) => {
36
36
  </View>
37
37
  );
38
38
 
39
+ useSetPageHeader(profile?.displayName || `@${handle}`);
40
+
39
41
  return (
40
42
  <ThemedSafeAreaView className="flex-1">
41
- <GenericHeader title={profile?.displayName || `@${handle}`} />
42
43
  {profileQuery.isLoading && !profile ? (
43
44
  <ActivityIndicator size="small" />
44
45
  ) : profile ? (
@@ -1,28 +1,36 @@
1
- import React from 'react';
2
- import {
3
- MainStackParamList,
4
- TabStackParamList,
5
- } from '../components/navigation/types/index';
1
+ import React, { useMemo, useRef, useState } from 'react';
2
+ import { RefreshControl, ScrollView } from 'react-native';
3
+ import { CompositeScreenProps } from '@react-navigation/native';
4
+ import { NativeStackScreenProps } from '@react-navigation/native-stack';
5
+ import { normalizeHashtagTag } from '@openpeepshq/common/types';
6
6
  import {
7
+ useCurrentProfile,
7
8
  useDefaultVisibility,
8
9
  useFeedListParams,
9
10
  useOpenpeeps,
10
11
  } from '@openpeepshq/react';
11
- import { GenericHeader } from '../components/custom/index';
12
- import { CompositeScreenProps } from '@react-navigation/native';
13
- import { NativeStackScreenProps } from '@react-navigation/native-stack';
14
- import { RefreshControl, ScrollView } from 'react-native';
15
-
12
+ import { useTranslation } from 'react-i18next';
13
+ import { useSetPageHeader } from '../components/layout';
16
14
  import { Feed, NewNoteButton } from '../components/post/index';
17
- import { TAB_ROUTES } from '../components/navigation/types/index';
15
+ import {
16
+ MainStackParamList,
17
+ TabStackParamList,
18
+ } from '../components/navigation/types/index';
19
+ import { Button } from '../components/ui/button';
20
+ import { ThemedText } from '../components/ui/themed-text';
21
+
18
22
  type HomeScreenProps = CompositeScreenProps<
19
23
  NativeStackScreenProps<TabStackParamList, 'HashtagPosts'>,
20
24
  NativeStackScreenProps<MainStackParamList>
21
25
  >;
22
- export const Tags: React.FC<HomeScreenProps> = ({ route, navigation }) => {
26
+
27
+ export const Tags: React.FC<HomeScreenProps> = ({ route }) => {
28
+ const { t } = useTranslation();
23
29
  const { openpeepsApi } = useOpenpeeps();
30
+ const me = useCurrentProfile();
24
31
  const { tag } = route.params;
25
32
  const visibility = useDefaultVisibility();
33
+ const [toggling, setToggling] = useState(false);
26
34
 
27
35
  const query = openpeepsApi.usePostsByHashtag(
28
36
  tag,
@@ -36,12 +44,62 @@ export const Tags: React.FC<HomeScreenProps> = ({ route, navigation }) => {
36
44
  setRefreshing(false);
37
45
  }, [query]);
38
46
 
47
+ const followHashtag = openpeepsApi.followHashtagAction({
48
+ tag,
49
+ } as never);
50
+ const unfollowHashtag = openpeepsApi.unfollowHashtagAction({
51
+ tag,
52
+ } as never);
53
+ const followHashtagRef = useRef(followHashtag);
54
+ const unfollowHashtagRef = useRef(unfollowHashtag);
55
+ followHashtagRef.current = followHashtag;
56
+ unfollowHashtagRef.current = unfollowHashtag;
57
+
58
+ const normalizedTag = normalizeHashtagTag(tag);
59
+ const isFollowing = !!me?.followedHashtags?.some(
60
+ (h) => h.tag === normalizedTag
61
+ );
62
+
63
+ const headerActions = useMemo(() => {
64
+ if (!me) return undefined;
65
+ const toggleFollow = async () => {
66
+ setToggling(true);
67
+ try {
68
+ if (isFollowing) {
69
+ await unfollowHashtagRef.current();
70
+ } else {
71
+ await followHashtagRef.current();
72
+ }
73
+ } finally {
74
+ setToggling(false);
75
+ }
76
+ };
77
+ return (
78
+ <Button
79
+ variant={isFollowing ? 'outline' : 'default'}
80
+ disabled={toggling}
81
+ onPress={() => void toggleFollow()}
82
+ >
83
+ <ThemedText
84
+ className={
85
+ isFollowing ? 'text-foreground' : 'text-primary-foreground'
86
+ }
87
+ >
88
+ {isFollowing
89
+ ? t('tags.following', { defaultValue: 'Following' })
90
+ : t('tags.follow', { defaultValue: 'Follow hashtag' })}
91
+ </ThemedText>
92
+ </Button>
93
+ );
94
+ }, [isFollowing, me, t, toggling]);
95
+
96
+ useSetPageHeader(
97
+ t('tags.title', { defaultValue: '#{{hashtag}}', hashtag: tag }),
98
+ headerActions
99
+ );
100
+
39
101
  return (
40
102
  <>
41
- <GenericHeader
42
- title={`#${tag}`}
43
- handleGoBack={() => navigation.navigate(TAB_ROUTES.HOME)}
44
- />
45
103
  <ScrollView
46
104
  className="bg-background"
47
105
  refreshControl={
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react';
2
2
  import { ThemedView } from '../components/ui/themed-view';
3
3
  import { ActivityIndicator, ScrollView, TouchableOpacity } from 'react-native';
4
4
  import { useOpenpeeps } from '@openpeepshq/react';
5
- import { TabScreensHeader } from '../components/custom/index';
5
+ import { useSetPageHeader } from '../components/layout';
6
6
  import {
7
7
  UserCheckIcon,
8
8
  MailCheckIcon,
@@ -122,15 +122,10 @@ export const Welcome = () => {
122
122
  ]
123
123
  );
124
124
 
125
+ useSetPageHeader(t('navigation.welcome'));
126
+
125
127
  return (
126
128
  <ThemedView className="flex-1">
127
- <TabScreensHeader
128
- children={
129
- <ThemedText className="text-2xl font-semibold">
130
- {t('navigation.welcome')}
131
- </ThemedText>
132
- }
133
- />
134
129
  <ScrollView className="p-4 w-full">
135
130
  {isLoading && <ActivityIndicator size={'small'} />}
136
131
  <ThemedView className="w-full mt-2">
@@ -5,10 +5,10 @@ import { useTranslation } from 'react-i18next';
5
5
  import Toast from 'react-native-toast-message';
6
6
  import { truncateText } from '@openpeepshq/common/lib';
7
7
  import { useEditArticle } from '@openpeepshq/react';
8
- import { GenericHeader } from '../../components/custom/index';
8
+ import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
9
+ import { ThemedView } from '../../components/ui/themed-view';
9
10
  import { MainScreenProps } from '../../components/navigation/types/index';
10
11
  import { ArticleForm } from '../../components/post/index';
11
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
12
12
  import { ThemedText } from '../../components/ui/themed-text';
13
13
 
14
14
  type EditArticleProps = MainScreenProps<'EditArticle'>;
@@ -37,19 +37,22 @@ export const EditArticle: React.FC<EditArticleProps> = ({ route }) => {
37
37
  ? `${t('articles.edit', { defaultValue: 'Edit article' })} ${truncateText(articleTitle)}`
38
38
  : t('articles.edit', { defaultValue: 'Edit article' });
39
39
 
40
+ useSetPageHeader(
41
+ title,
42
+ <HeaderActionButton
43
+ title={
44
+ submitting
45
+ ? t('common.saving', { defaultValue: 'Saving…' })
46
+ : t('articles.update.title', { defaultValue: 'Update article' })
47
+ }
48
+ onPress={() => void submit()}
49
+ disabled={submitting || !postData}
50
+ loading={submitting}
51
+ />
52
+ );
53
+
40
54
  return (
41
- <ThemedSafeAreaView className="flex-1">
42
- <GenericHeader
43
- title={title}
44
- rightButtonTitle={
45
- submitting
46
- ? t('common.saving', { defaultValue: 'Saving…' })
47
- : t('articles.update.title', { defaultValue: 'Update article' })
48
- }
49
- onRightButtonPress={() => void submit()}
50
- rightButtonDisabled={submitting || !postData}
51
- rightType="button"
52
- />
55
+ <ThemedView className="flex-1">
53
56
  {postQuery.isLoading ? (
54
57
  <ActivityIndicator size="small" />
55
58
  ) : !postQuery.data || !postData ? (
@@ -64,6 +67,6 @@ export const EditArticle: React.FC<EditArticleProps> = ({ route }) => {
64
67
  <ArticleForm postData={postData} onChange={setPostData} isEdit />
65
68
  </KeyboardAwareScrollView>
66
69
  )}
67
- </ThemedSafeAreaView>
70
+ </ThemedView>
68
71
  );
69
72
  };
@@ -3,10 +3,11 @@ import { useNavigation } from '@react-navigation/native';
3
3
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useFeedListParams, useOpenpeeps } from '@openpeepshq/react';
6
- import { PlusFab, TabScreensHeader } from '../../components/custom/index';
7
- import { FilePlusIcon } from '../../components/icons/index';
6
+ import {
7
+ useSetPageHeader,
8
+ useSetPlusButtonActions,
9
+ } from '../../components/layout';
8
10
  import { MainStackParamList } from '../../components/navigation/types/index';
9
- import { ThemedText } from '../../components/ui/themed-text';
10
11
 
11
12
  import { Feed } from '../../components/post/index';
12
13
  export const ArticlesIndex = () => {
@@ -20,22 +21,11 @@ export const ArticlesIndex = () => {
20
21
  useFeedListParams({ limit: 15 })
21
22
  );
22
23
 
23
- return (
24
- <>
25
- <TabScreensHeader
26
- children={
27
- <ThemedText className="text-xl font-bold">
28
- {t('navigation.articles')}
29
- </ThemedText>
30
- }
31
- />
32
- <Feed query={articlesQuery} />
33
- <PlusFab
34
- accessibilityLabel={t('articles.new')}
35
- onPress={() => navigation.navigate('NewArticle')}
36
- >
37
- <FilePlusIcon size={24} className="text-background" />
38
- </PlusFab>
39
- </>
40
- );
24
+ useSetPageHeader(t('navigation.articles'));
25
+ useSetPlusButtonActions({
26
+ title: t('articles.new'),
27
+ action: () => navigation.navigate('NewArticle'),
28
+ });
29
+
30
+ return <Feed query={articlesQuery} />;
41
31
  };
@@ -3,10 +3,10 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import Toast from 'react-native-toast-message';
5
5
  import { useNewArticle } from '@openpeepshq/react';
6
- import { GenericHeader } from '../../components/custom/index';
6
+ import { HeaderActionButton, useSetPageHeader } from '../../components/layout';
7
+ import { ThemedView } from '../../components/ui/themed-view';
7
8
  import { MainScreenProps } from '../../components/navigation/types/index';
8
9
  import { ArticleForm } from '../../components/post/index';
9
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
10
10
 
11
11
  type NewArticleProps = MainScreenProps<'NewArticle'>;
12
12
 
@@ -28,25 +28,28 @@ export const NewArticle: React.FC<NewArticleProps> = () => {
28
28
  clearError();
29
29
  }, [error, clearError]);
30
30
 
31
+ useSetPageHeader(
32
+ t('articles.new', { defaultValue: 'New article' }),
33
+ <HeaderActionButton
34
+ title={
35
+ submitting
36
+ ? t('common.submitting', { defaultValue: 'Publishing…' })
37
+ : t('articles.create.title', { defaultValue: 'Create article' })
38
+ }
39
+ onPress={() => void submit()}
40
+ disabled={submitting || !canSubmit}
41
+ loading={submitting}
42
+ />
43
+ );
44
+
31
45
  return (
32
- <ThemedSafeAreaView className="flex-1">
33
- <GenericHeader
34
- title={t('articles.new', { defaultValue: 'New article' })}
35
- rightButtonTitle={
36
- submitting
37
- ? t('common.submitting', { defaultValue: 'Publishing…' })
38
- : t('articles.create.title', { defaultValue: 'Create article' })
39
- }
40
- onRightButtonPress={() => void submit()}
41
- rightButtonDisabled={submitting || !canSubmit}
42
- rightType="button"
43
- />
46
+ <ThemedView className="flex-1">
44
47
  <KeyboardAwareScrollView
45
48
  contentContainerClassName="grow"
46
49
  className="pb-12"
47
50
  >
48
51
  <ArticleForm postData={postData} onChange={setPostData} />
49
52
  </KeyboardAwareScrollView>
50
- </ThemedSafeAreaView>
53
+ </ThemedView>
51
54
  );
52
55
  };
@@ -5,18 +5,14 @@ import {
5
5
  View,
6
6
  } from 'react-native';
7
7
  import React, { useEffect, useRef } from 'react';
8
+ import { EmptyStateContainer } from '../../components/custom/index';
8
9
  import {
9
- TabScreensHeader,
10
- EmptyStateContainer,
11
- PlusFab,
12
- } from '../../components/custom/index';
10
+ useSetPageHeader,
11
+ useSetPlusButtonActions,
12
+ } from '../../components/layout';
13
13
  import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
14
14
  import { useAuthData, useOpenpeeps } from '@openpeepshq/react';
15
- import {
16
- MessageSquarePlusIcon,
17
- SearchIcon,
18
- XIcon,
19
- } from '../../components/icons/index';
15
+ import { SearchIcon, XIcon } from '../../components/icons/index';
20
16
  import { CompositeScreenProps } from '@react-navigation/native';
21
17
  import { NativeStackScreenProps } from '@react-navigation/native-stack';
22
18
  import {
@@ -25,7 +21,6 @@ import {
25
21
  } from '../../components/navigation/types/index';
26
22
  import { canCreatePost, PublicPost } from '@openpeepshq/common';
27
23
  import { Input } from '../../components/ui/input';
28
- import { ThemedText } from '../../components/ui/themed-text';
29
24
  import { profileMatchesQuery } from '../../lib/utils';
30
25
  import { BottomSheetModal } from '@gorhom/bottom-sheet';
31
26
 
@@ -85,57 +80,46 @@ export const ConversationsIndex: React.FC<MessagesProps> = ({ navigation }) => {
85
80
  }
86
81
  }, [conversations, searchQuery]);
87
82
 
88
- return (
89
- <View className="flex-1 relative">
90
- <TabScreensHeader
91
- children={
92
- <View className="flex-row items-center justify-between p-4">
93
- {!isSearchToggled && (
94
- <ThemedText className="text-2xl font-semibold">
95
- {t('navigation.messages')}
96
- </ThemedText>
97
- )}
98
- <View
99
- className={`${
100
- isSearchToggled
101
- ? 'flex justify-end '
102
- : 'flex-row items-center gap-x-6'
103
- }`}
104
- >
105
- {isSearchToggled ? (
106
- <View className="ml-4 w-full flex-row flex justify-end">
107
- <Input
108
- className="flex-1"
109
- placeholder={t('conversations.search.placeholder')}
110
- value={searchQuery}
111
- onChangeText={setSearchQuery}
112
- />
113
- <TouchableOpacity
114
- className="items-center justify-center px-4"
115
- onPress={() => {
116
- setSearchQuery('');
117
- setIsSearchToggled(false);
118
- }}
119
- >
120
- <XIcon size={24} className="text-foreground" />
121
- </TouchableOpacity>
122
- </View>
123
- ) : (
124
- <>
125
- <TouchableOpacity onPress={() => setIsSearchToggled(true)}>
126
- <SearchIcon size={20} className="text-foreground" />
127
- </TouchableOpacity>
128
- <DirectMessagesHeaderActions />
129
- {/* TODO Uncomment when conversation settings are implemented */}
130
- {/* <TouchableOpacity onPress={handleSettingsPress}>
131
- <Settings2Icon size={20} className="text-foreground" />
132
- </TouchableOpacity> */}
133
- </>
134
- )}
135
- </View>
136
- </View>
83
+ useSetPageHeader(
84
+ t('navigation.messages'),
85
+ <View className="flex-row items-center gap-x-3">
86
+ {isSearchToggled ? (
87
+ <View className="max-w-[180px] flex-row items-center">
88
+ <Input
89
+ className="flex-1"
90
+ placeholder={t('conversations.search.placeholder')}
91
+ value={searchQuery}
92
+ onChangeText={setSearchQuery}
93
+ />
94
+ <TouchableOpacity
95
+ className="items-center justify-center px-2"
96
+ onPress={() => {
97
+ setSearchQuery('');
98
+ setIsSearchToggled(false);
99
+ }}
100
+ >
101
+ <XIcon size={20} className="text-foreground" />
102
+ </TouchableOpacity>
103
+ </View>
104
+ ) : (
105
+ <TouchableOpacity onPress={() => setIsSearchToggled(true)}>
106
+ <SearchIcon size={20} className="text-foreground" />
107
+ </TouchableOpacity>
108
+ )}
109
+ <DirectMessagesHeaderActions />
110
+ </View>
111
+ );
112
+ useSetPlusButtonActions(
113
+ canCreate
114
+ ? {
115
+ title: t('conversations.newMessage'),
116
+ action: () => openCreateConversation(),
137
117
  }
138
- />
118
+ : undefined
119
+ );
120
+
121
+ return (
122
+ <View className="relative flex-1">
139
123
  <KeyboardAwareScrollView
140
124
  refreshControl={
141
125
  <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
@@ -165,14 +149,6 @@ export const ConversationsIndex: React.FC<MessagesProps> = ({ navigation }) => {
165
149
  />
166
150
  ))}
167
151
  </KeyboardAwareScrollView>
168
- {canCreate ? (
169
- <PlusFab
170
- accessibilityLabel={t('conversations.newMessage')}
171
- onPress={() => openCreateConversation()}
172
- >
173
- <MessageSquarePlusIcon size={24} className="text-background" />
174
- </PlusFab>
175
- ) : null}
176
152
  <ConversationSettingsSheet
177
153
  ref={settingsRef}
178
154
  onMessageRequestChange={(value) => {
@@ -9,12 +9,12 @@ import { ScrollView, TouchableOpacity, View } from 'react-native';
9
9
  import { ThemedText } from '../../components/ui/themed-text';
10
10
  import { FollowUnfollowButton } from '../../components/profile/FollowUnfollowButton';
11
11
 
12
- import { ThemedSafeAreaView } from '../../components/ui/themed-safe-area-view';
13
12
  import { useNavigation } from '@react-navigation/native';
14
13
  import { NativeStackNavigationProp } from '@react-navigation/native-stack';
15
14
  import { ProfileAvatar } from '../../components/profile/Avatar';
16
15
 
17
- import { GenericHeader } from '../../components/custom/headers/index';
16
+ import { useSetPageHeader } from '../../components/layout';
17
+ import { ThemedView } from '../../components/ui/themed-view';
18
18
  import {
19
19
  ProfileBio,
20
20
  ProfileHandle,
@@ -35,9 +35,10 @@ export const ConversationInfo = ({ route }: ConversationInfoProps) => {
35
35
  const navigation =
36
36
  useNavigation<NativeStackNavigationProp<MainStackParamList>>();
37
37
 
38
+ useSetPageHeader(t('conversations.info'));
39
+
38
40
  return (
39
- <ThemedSafeAreaView className="flex-1">
40
- <GenericHeader title={t('conversations.info')} />
41
+ <ThemedView className="flex-1">
41
42
  <ScrollView className="flex-1">
42
43
  {isGroupChat ? (
43
44
  <>
@@ -93,6 +94,6 @@ export const ConversationInfo = ({ route }: ConversationInfoProps) => {
93
94
  </View>
94
95
  )}
95
96
  </ScrollView>
96
- </ThemedSafeAreaView>
97
+ </ThemedView>
97
98
  );
98
99
  };