diff --git a/native/chat/message-list-types.js b/native/chat/message-list-types.js index 0940b8012..2042b10b7 100644 --- a/native/chat/message-list-types.js +++ b/native/chat/message-list-types.js @@ -1,34 +1,33 @@ // @flow import * as React from 'react'; import type { ThreadInfo } from 'lib/types/thread-types'; import { type UserInfo } from 'lib/types/user-types'; import type { MarkdownRules } from '../markdown/rules.react'; import { useTextMessageRulesFunc } from '../markdown/rules.react'; export type MessageListParams = {| +threadInfo: ThreadInfo, - +sourceMessageID?: string, +pendingPersonalThreadUserInfo?: UserInfo, +searching?: boolean, |}; export type MessageListContextType = {| +getTextMessageMarkdownRules: (useDarkStyle: boolean) => MarkdownRules, |}; const MessageListContext = React.createContext(); function useMessageListContext(threadID: string) { const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadID); return React.useMemo( () => ({ getTextMessageMarkdownRules, }), [getTextMessageMarkdownRules], ); } export { MessageListContext, useMessageListContext }; diff --git a/native/chat/sidebar-navigation.js b/native/chat/sidebar-navigation.js index bde678181..fe4ff9388 100644 --- a/native/chat/sidebar-navigation.js +++ b/native/chat/sidebar-navigation.js @@ -1,94 +1,92 @@ // @flow import invariant from 'invariant'; import { createPendingSidebar } from 'lib/shared/thread-utils'; import type { DispatchFunctions, ActionFunc } from 'lib/utils/action-utils'; import type { InputState } from '../input/input-state'; import { getDefaultTextMessageRules } from '../markdown/rules.react'; import type { AppNavigationProp } from '../navigation/app-navigator.react'; import { MessageListRouteName } from '../navigation/route-names'; import type { TooltipRoute } from '../navigation/tooltip.react'; function onPressGoToSidebar( route: | TooltipRoute<'RobotextMessageTooltipModal'> | TooltipRoute<'TextMessageTooltipModal'> | TooltipRoute<'MultimediaTooltipModal'>, dispatchFunctions: DispatchFunctions, bindServerCall: (serverCall: ActionFunc) => F, inputState: ?InputState, navigation: | AppNavigationProp<'RobotextMessageTooltipModal'> | AppNavigationProp<'TextMessageTooltipModal'> | AppNavigationProp<'MultimediaTooltipModal'>, ) { let threadCreatedFromMessage; // Necessary for Flow... if (route.name === 'RobotextMessageTooltipModal') { threadCreatedFromMessage = route.params.item.threadCreatedFromMessage; } else { threadCreatedFromMessage = route.params.item.threadCreatedFromMessage; } invariant( threadCreatedFromMessage, 'threadCreatedFromMessage should be set in onPressGoToSidebar', ); navigation.navigate({ name: MessageListRouteName, params: { threadInfo: threadCreatedFromMessage, }, key: `${MessageListRouteName}${threadCreatedFromMessage.id}`, }); } function onPressCreateSidebar( route: | TooltipRoute<'RobotextMessageTooltipModal'> | TooltipRoute<'TextMessageTooltipModal'> | TooltipRoute<'MultimediaTooltipModal'>, dispatchFunctions: DispatchFunctions, bindServerCall: (serverCall: ActionFunc) => F, inputState: ?InputState, navigation: | AppNavigationProp<'RobotextMessageTooltipModal'> | AppNavigationProp<'TextMessageTooltipModal'> | AppNavigationProp<'MultimediaTooltipModal'>, viewerID: ?string, ) { invariant( viewerID, 'viewerID should be set in TextMessageTooltipModal.onPressCreateSidebar', ); let itemFromParams; // Necessary for Flow... if (route.name === 'RobotextMessageTooltipModal') { itemFromParams = route.params.item; } else { itemFromParams = route.params.item; } const { messageInfo, threadInfo } = itemFromParams; const pendingSidebarInfo = createPendingSidebar( messageInfo, threadInfo, viewerID, getDefaultTextMessageRules().simpleMarkdownRules, ); - const sourceMessageID = messageInfo.id; navigation.navigate({ name: MessageListRouteName, params: { threadInfo: pendingSidebarInfo, - sourceMessageID, }, key: `${MessageListRouteName}${pendingSidebarInfo.id}`, }); } export { onPressGoToSidebar, onPressCreateSidebar };