diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js --- a/native/chat/chat.react.js +++ b/native/chat/chat.react.js @@ -39,6 +39,7 @@ import HomeChatThreadList from './home-chat-thread-list.react.js'; import MessageListContainer from './message-list-container.react.js'; import MessageListHeaderTitle from './message-list-header-title.react.js'; +import MessageResultsScreen from './message-results-screen.react.js'; import MessageStorePruner from './message-store-pruner.react.js'; import DeleteThread from './settings/delete-thread.react.js'; import EmojiThreadAvatarCreation from './settings/emoji-thread-avatar-creation.react.js'; @@ -59,6 +60,7 @@ ThreadSettingsRouteName, EmojiThreadAvatarCreationRouteName, FullScreenThreadMediaGalleryRouteName, + MessageResultsScreenRouteName, MessageListRouteName, ChatThreadListRouteName, HomeChatThreadListRouteName, @@ -266,6 +268,10 @@ headerTitle: 'Delete chat', headerBackTitleVisible: false, }; +const messageResultsScreenOptions = { + headerTitle: 'Pinned Messages', + headerBackTitleVisible: false, +}; export type ChatNavigationProp< RouteName: $Keys = $Keys, @@ -374,6 +380,11 @@ component={DeleteThread} options={deleteThreadOptions} /> + diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js --- a/native/chat/message-list-container.react.js +++ b/native/chat/message-list-container.react.js @@ -38,7 +38,10 @@ type OverlayContextType, } from '../navigation/overlay-context.js'; import type { NavigationRoute } from '../navigation/route-names.js'; -import { ThreadSettingsRouteName } from '../navigation/route-names.js'; +import { + ThreadSettingsRouteName, + MessageResultsScreenRouteName, +} from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../themes/colors.js'; import type { ChatMessageItemWithHeight } from '../types/chat-types.js'; @@ -370,6 +373,16 @@ bannerText = `${threadInfo.pinnedCount} pinned ${messageNoun}`; } + const navigateToMessageResults = React.useCallback(() => { + props.navigation.navigate<'MessageResultsScreen'>({ + name: MessageResultsScreenRouteName, + params: { + threadInfo, + }, + key: `PinnedMessages${threadInfo.id}`, + }); + }, [props.navigation, threadInfo]); + const pinnedCountBanner = React.useMemo(() => { if (!bannerText) { return null; @@ -377,7 +390,12 @@ return ( - {bannerText} + + {bannerText} + ); }, [ + navigateToMessageResults, bannerText, styles.pinnedCountBanner, styles.pinnedCountText, diff --git a/native/chat/message-results-screen.react.js b/native/chat/message-results-screen.react.js new file mode 100644 --- /dev/null +++ b/native/chat/message-results-screen.react.js @@ -0,0 +1,24 @@ +// @flow + +import * as React from 'react'; + +import type { ThreadInfo } from 'lib/types/thread-types.js'; + +import type { ChatNavigationProp } from './chat.react'; +import type { NavigationRoute } from '../navigation/route-names'; + +export type MessageResultsScreenParams = { + +threadInfo: ThreadInfo, +}; + +type MessageResultsScreenProps = { + +navigation: ChatNavigationProp<'MessageResultsScreen'>, + +route: NavigationRoute<'MessageResultsScreen'>, +}; + +// eslint-disable-next-line no-unused-vars +function MessageResultsScreen(props: MessageResultsScreenProps): React.Node { + return null; +} + +export default MessageResultsScreen; diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -13,6 +13,7 @@ import type { ImagePasteModalParams } from '../chat/image-paste-modal.react.js'; import type { MessageListParams } from '../chat/message-list-types.js'; import type { MessageReactionsModalParams } from '../chat/message-reactions-modal.react.js'; +import type { MessageResultsScreenParams } from '../chat/message-results-screen.react.js'; import type { MultimediaMessageTooltipModalParams } from '../chat/multimedia-message-tooltip-modal.react.js'; import type { RobotextMessageTooltipModalParams } from '../chat/robotext-message-tooltip-modal.react.js'; import type { AddUsersModalParams } from '../chat/settings/add-users-modal.react.js'; @@ -67,6 +68,7 @@ export const LoggedOutModalRouteName = 'LoggedOutModal'; export const MessageListRouteName = 'MessageList'; export const MessageReactionsModalRouteName = 'MessageReactionsModal'; +export const MessageResultsScreenRouteName = 'MessageResultsScreen'; export const MultimediaMessageTooltipModalRouteName = 'MultimediaMessageTooltipModal'; export const PrivacyPreferencesRouteName = 'PrivacyPreferences'; @@ -156,6 +158,7 @@ +EmojiThreadAvatarCreation: EmojiThreadAvatarCreationParams, +DeleteThread: DeleteThreadParams, +FullScreenThreadMediaGallery: FullScreenThreadMediaGalleryParams, + +MessageResultsScreen: MessageResultsScreenParams, }; export type ChatTopTabsParamList = { @@ -223,4 +226,5 @@ DeleteThreadRouteName, ComposeSubchannelRouteName, FullScreenThreadMediaGalleryRouteName, + MessageResultsScreenRouteName, ];