diff --git a/native/chat/inline-sidebar-constants.js b/native/chat/chat-constants.js rename from native/chat/inline-sidebar-constants.js rename to native/chat/chat-constants.js --- a/native/chat/inline-sidebar-constants.js +++ b/native/chat/chat-constants.js @@ -3,3 +3,5 @@ export const inlineSidebarHeight = 20; export const inlineSidebarMarginTop = 5; export const inlineSidebarMarginBottom = 3; + +export const clusterEndHeight = 7; diff --git a/native/chat/chat-item-height-measurer.react.js b/native/chat/chat-item-height-measurer.react.js --- a/native/chat/chat-item-height-measurer.react.js +++ b/native/chat/chat-item-height-measurer.react.js @@ -10,12 +10,12 @@ import NodeHeightMeasurer from '../components/node-height-measurer.react'; import { InputStateContext } from '../input/input-state'; import type { MeasurementTask } from './chat-context-provider.react'; -import { chatMessageItemKey } from './chat-message-constants'; import { useComposedMessageMaxWidth } from './composed-message-width'; import { dummyNodeForRobotextMessageHeightMeasurement } from './inner-robotext-message.react'; import { dummyNodeForTextMessageHeightMeasurement } from './inner-text-message.react'; import { MessageListContextProvider } from './message-list-types'; import { multimediaMessageContentSizes } from './multimedia-message-utils'; +import { chatMessageItemKey } from './utils'; type Props = { +measurement: MeasurementTask, diff --git a/native/chat/chat-list.react.js b/native/chat/chat-list.react.js --- a/native/chat/chat-list.react.js +++ b/native/chat/chat-list.react.js @@ -23,10 +23,9 @@ import type { ChatMessageItemWithHeight } from '../types/chat-types'; import type { ScrollEvent } from '../types/react-native'; import type { ViewStyle } from '../types/styles'; -import { chatMessageItemKey } from './chat-message-constants'; import type { ChatNavigationProp } from './chat.react'; import NewMessagesPill from './new-messages-pill.react'; -import { chatMessageItemHeight } from './utils'; +import { chatMessageItemHeight, chatMessageItemKey } from './utils'; const animationSpec = { duration: 150, diff --git a/native/chat/chat-message-constants.js b/native/chat/chat-message-constants.js deleted file mode 100644 --- a/native/chat/chat-message-constants.js +++ /dev/null @@ -1,15 +0,0 @@ -// @flow - -import type { ChatMessageItem } from 'lib/selectors/chat-selectors'; -import { messageKey } from 'lib/shared/message-utils'; - -import type { ChatMessageItemWithHeight } from '../types/chat-types'; - -export function chatMessageItemKey( - item: ChatMessageItemWithHeight | ChatMessageItem, -): string { - if (item.itemType === 'loader') { - return 'loader'; - } - return messageKey(item.messageInfo); -} diff --git a/native/chat/composed-message-constants.js b/native/chat/composed-message-constants.js deleted file mode 100644 --- a/native/chat/composed-message-constants.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -export const clusterEndHeight = 7; diff --git a/native/chat/composed-message.react.js b/native/chat/composed-message.react.js --- a/native/chat/composed-message.react.js +++ b/native/chat/composed-message.react.js @@ -13,13 +13,13 @@ import { type Colors, useColors } from '../themes/colors'; import type { ChatMessageInfoItemWithHeight } from '../types/chat-types'; import { type AnimatedStyleObj, AnimatedView } from '../types/styles'; -import { clusterEndHeight } from './composed-message-constants'; -import { useComposedMessageMaxWidth } from './composed-message-width'; -import { FailedSend } from './failed-send.react'; import { - inlineSidebarMarginTop, + clusterEndHeight, inlineSidebarMarginBottom, -} from './inline-sidebar-constants'; + inlineSidebarMarginTop, +} from './chat-constants'; +import { useComposedMessageMaxWidth } from './composed-message-width'; +import { FailedSend } from './failed-send.react'; import InlineSidebar from './inline-sidebar.react'; import { MessageHeader } from './message-header.react'; import { useNavigateToSidebar } from './sidebar-navigation'; diff --git a/native/chat/inline-sidebar.react.js b/native/chat/inline-sidebar.react.js --- a/native/chat/inline-sidebar.react.js +++ b/native/chat/inline-sidebar.react.js @@ -9,7 +9,7 @@ import Button from '../components/button.react'; import { useStyles } from '../themes/colors'; -import { inlineSidebarHeight } from './inline-sidebar-constants'; +import { inlineSidebarHeight } from './chat-constants'; import { useNavigateToThread } from './message-list-types'; type Props = { diff --git a/native/chat/message-header.react.js b/native/chat/message-header.react.js --- a/native/chat/message-header.react.js +++ b/native/chat/message-header.react.js @@ -8,7 +8,7 @@ import { SingleLine } from '../components/single-line.react'; import { useStyles } from '../themes/colors'; import type { ChatMessageInfoItemWithHeight } from '../types/chat-types'; -import { clusterEndHeight } from './composed-message-constants'; +import { clusterEndHeight } from './chat-constants'; import type { DisplayType } from './timestamp.react'; import { Timestamp, timestampHeight } from './timestamp.react'; diff --git a/native/chat/multimedia-message-utils.js b/native/chat/multimedia-message-utils.js --- a/native/chat/multimedia-message-utils.js +++ b/native/chat/multimedia-message-utils.js @@ -10,13 +10,13 @@ ChatMultimediaMessageInfoItem, MultimediaContentSizes, } from '../types/chat-types'; -import { clusterEndHeight } from './composed-message-constants'; -import { failedSendHeight } from './failed-send.react'; import { inlineSidebarMarginBottom, inlineSidebarMarginTop, inlineSidebarHeight, -} from './inline-sidebar-constants'; + clusterEndHeight, +} from './chat-constants'; +import { failedSendHeight } from './failed-send.react'; import { authorNameHeight } from './message-header.react'; const spaceBetweenImages = 4; diff --git a/native/chat/utils.js b/native/chat/utils.js --- a/native/chat/utils.js +++ b/native/chat/utils.js @@ -5,6 +5,7 @@ import Animated from 'react-native-reanimated'; import { useMessageListData } from 'lib/selectors/chat-selectors'; +import type { ChatMessageItem } from 'lib/selectors/chat-selectors'; import { messageKey } from 'lib/shared/message-utils'; import { colorIsDark, viewerIsMember } from 'lib/shared/thread-utils'; import type { ThreadInfo } from 'lib/types/thread-types'; @@ -25,14 +26,14 @@ } from '../types/chat-types'; import type { LayoutCoordinates, VerticalBounds } from '../types/layout-types'; import type { AnimatedViewStyle } from '../types/styles'; -import { ChatContext, useHeightMeasurer } from './chat-context'; -import { clusterEndHeight } from './composed-message-constants'; -import { failedSendHeight } from './failed-send.react'; import { + clusterEndHeight, inlineSidebarHeight, inlineSidebarMarginBottom, inlineSidebarMarginTop, -} from './inline-sidebar-constants'; +} from './chat-constants'; +import { ChatContext, useHeightMeasurer } from './chat-context'; +import { failedSendHeight } from './failed-send.react'; import { authorNameHeight } from './message-header.react'; import { multimediaMessageItemHeight } from './multimedia-message-utils'; import { getSidebarThreadInfo } from './sidebar-navigation'; @@ -401,7 +402,17 @@ ]); } +function chatMessageItemKey( + item: ChatMessageItemWithHeight | ChatMessageItem, +): string { + if (item.itemType === 'loader') { + return 'loader'; + } + return messageKey(item.messageInfo); +} + export { + chatMessageItemKey, chatMessageItemHeight, useAnimatedMessageTooltipButton, messageItemHeight,