Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353165
D3996.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D3996.diff
View Options
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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 8:43 AM (22 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574715
Default Alt Text
D3996.diff (7 KB)
Attached To
Mode
D3996: [native] [refactor] [ENG-530] organize constants and utils in chat directory
Attached
Detach File
Event Timeline
Log In to Comment