@cometchat/chat-uikit-react-native 5.2.11 → 5.3.1
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.
- package/android/build.gradle +3 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +4 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +909 -10
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorPackage.kt +24 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +5382 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +452 -0
- package/ios/FileManager.m +430 -3
- package/ios/RichTextEditorView.swift +5504 -0
- package/ios/RichTextEditorViewManager.m +66 -0
- package/ios/RichTextEditorViewManager.swift +291 -0
- package/ios/ToolbarIcons.swift +736 -0
- package/package.json +1 -1
- package/react-native-cometchat-ui-kit.podspec +1 -1
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +4602 -0
- package/src/CometChatCompactMessageComposer/SingleLineTextComposerConfiguration.tsx +568 -0
- package/src/CometChatCompactMessageComposer/heightUtils.ts +204 -0
- package/src/CometChatCompactMessageComposer/index.ts +56 -0
- package/src/CometChatCompactMessageComposer/resources/index.ts +5 -0
- package/src/CometChatCompactMessageComposer/styles.ts +291 -0
- package/src/CometChatConversations/CometChatConversations.tsx +141 -14
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +6 -0
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +1 -20
- package/src/CometChatMessageComposer/styles.tsx +0 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +76 -30
- package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +105 -0
- package/src/CometChatRichTextEditor/index.tsx +385 -0
- package/src/CometChatRichTextEditor/types.ts +162 -0
- package/src/CometChatSearch/CometChatSearch.tsx +35 -29
- package/src/calls/CallUtils.ts +4 -4
- package/src/index.ts +48 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +2 -0
- package/src/shared/constants/UIKitConstants.ts +12 -1
- package/src/shared/events/ListenerInitializer.ts +6 -0
- package/src/shared/events/messages.ts +2 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +5 -5
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +768 -0
- package/src/shared/formatters/index.ts +3 -0
- package/src/shared/framework/MessageDataSource.tsx +93 -2
- package/src/shared/helper/composerHelpers.ts +553 -0
- package/src/shared/helper/useKeyboard.tsx +7 -17
- package/src/shared/icons/components/code-blocks.tsx +13 -0
- package/src/shared/icons/components/code.tsx +11 -0
- package/src/shared/icons/components/format-bold.tsx +11 -0
- package/src/shared/icons/components/format-italic.tsx +11 -0
- package/src/shared/icons/components/format-list-bulleted.tsx +11 -0
- package/src/shared/icons/components/format-list-numbered.tsx +11 -0
- package/src/shared/icons/components/format-quote.tsx +13 -0
- package/src/shared/icons/components/format-strikethrough.tsx +13 -0
- package/src/shared/icons/components/format-underlined.tsx +11 -0
- package/src/shared/icons/components/smileys-&-people.tsx +1 -1
- package/src/shared/icons/icon-mapping.tsx +18 -0
- package/src/shared/index.ts +54 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +37 -32
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +5 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +18 -13
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +132 -11
- package/src/shared/utils/CometChatMessagePreview/style.ts +1 -3
- package/src/shared/utils/CommonUtils.ts +18 -1
- package/src/shared/utils/MarkdownUtils.ts +143 -0
- package/src/shared/utils/MentionUtils.ts +37 -0
- package/src/shared/utils/MessageReceiptUtils.ts +5 -4
- package/src/shared/utils/MessageUtils.tsx +5 -3
- package/src/shared/utils/index.ts +5 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +1 -1
- package/src/shared/views/CometChatInlineAudioRecorder/AudioWaveformVisualizer.tsx +417 -0
- package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +537 -0
- package/src/shared/views/CometChatInlineAudioRecorder/index.ts +34 -0
- package/src/shared/views/CometChatInlineAudioRecorder/style.ts +155 -0
- package/src/shared/views/CometChatInlineAudioRecorder/types.ts +303 -0
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +1336 -0
- package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +183 -0
- package/src/shared/views/CometChatLinkConfirmPopup/index.ts +13 -0
- package/src/shared/views/CometChatLinkConfirmPopup/style.ts +128 -0
- package/src/shared/views/CometChatList/Header.tsx +2 -1
- package/src/shared/views/CometChatListItem/style.ts +1 -0
- package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +32 -29
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +64 -16
- package/src/shared/views/index.ts +39 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Height Calculation Utility Functions for Auto-Expanding TextInput
|
|
3
|
+
*
|
|
4
|
+
* These pure functions handle height calculations for the auto-expanding
|
|
5
|
+
* TextInput feature in CometChatSingleLineMessageComposer.
|
|
6
|
+
*
|
|
7
|
+
* @module heightUtils
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Default constants for height calculations
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_MIN_HEIGHT = 24;
|
|
14
|
+
export const DEFAULT_MAX_HEIGHT = 200;
|
|
15
|
+
export const DEFAULT_LINE_HEIGHT = 24;
|
|
16
|
+
export const DEFAULT_MAX_LINES = 5;
|
|
17
|
+
export const DEFAULT_PADDING_VERTICAL = 12;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Pure function to calculate the target input height.
|
|
21
|
+
* Clamps the content height between minHeight and maxHeight.
|
|
22
|
+
*
|
|
23
|
+
* @param contentHeight - The actual content height from onContentSizeChange
|
|
24
|
+
* @param minHeight - Minimum allowed height (must be positive)
|
|
25
|
+
* @param maxHeight - Maximum allowed height (must be >= minHeight)
|
|
26
|
+
* @returns The clamped height value
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Content fits within bounds
|
|
30
|
+
* calculateInputHeight(100, 40, 200) // returns 100
|
|
31
|
+
*
|
|
32
|
+
* // Content exceeds max
|
|
33
|
+
* calculateInputHeight(250, 40, 200) // returns 200
|
|
34
|
+
*
|
|
35
|
+
* // Content below min
|
|
36
|
+
* calculateInputHeight(20, 40, 200) // returns 40
|
|
37
|
+
*
|
|
38
|
+
* **Validates: Requirements 1.1, 1.2, 1.3**
|
|
39
|
+
*/
|
|
40
|
+
export function calculateInputHeight(
|
|
41
|
+
contentHeight: number,
|
|
42
|
+
minHeight: number,
|
|
43
|
+
maxHeight: number
|
|
44
|
+
): number {
|
|
45
|
+
// Input validation: handle negative or zero values
|
|
46
|
+
const validContentHeight = Math.max(0, contentHeight);
|
|
47
|
+
const validMinHeight = Math.max(1, minHeight);
|
|
48
|
+
// Ensure maxHeight is at least minHeight
|
|
49
|
+
const validMaxHeight = Math.max(validMinHeight, maxHeight);
|
|
50
|
+
|
|
51
|
+
// Clamp content height between min and max
|
|
52
|
+
return Math.min(Math.max(validContentHeight, validMinHeight), validMaxHeight);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Pure function to calculate max height from maxLines.
|
|
57
|
+
* Computes the maximum height based on number of lines, line height, and padding.
|
|
58
|
+
*
|
|
59
|
+
* @param maxLines - Number of lines (must be positive, defaults to DEFAULT_MAX_LINES)
|
|
60
|
+
* @param lineHeight - Height per line in pixels (must be positive)
|
|
61
|
+
* @param paddingVertical - Vertical padding in pixels (must be non-negative)
|
|
62
|
+
* @returns Maximum height in pixels
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // 5 lines with 24px line height and 12px padding
|
|
66
|
+
* calculateMaxHeightFromLines(5, 24, 12) // returns 144 (5 * 24 + 12 * 2)
|
|
67
|
+
*
|
|
68
|
+
* **Validates: Requirements 2.3**
|
|
69
|
+
*/
|
|
70
|
+
export function calculateMaxHeightFromLines(
|
|
71
|
+
maxLines: number,
|
|
72
|
+
lineHeight: number,
|
|
73
|
+
paddingVertical: number
|
|
74
|
+
): number {
|
|
75
|
+
// Input validation: handle negative or zero values
|
|
76
|
+
const validMaxLines = Math.max(1, maxLines);
|
|
77
|
+
const validLineHeight = Math.max(1, lineHeight);
|
|
78
|
+
const validPaddingVertical = Math.max(0, paddingVertical);
|
|
79
|
+
|
|
80
|
+
return validMaxLines * validLineHeight + validPaddingVertical * 2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Pure function to determine icon alignment based on expansion state.
|
|
85
|
+
* Returns 'flex-start' (top alignment) when expanded, 'center' when collapsed.
|
|
86
|
+
*
|
|
87
|
+
* @param currentHeight - Current input height in pixels
|
|
88
|
+
* @param minHeight - Minimum (single-line) height in pixels
|
|
89
|
+
* @returns 'flex-start' when expanded (height > minHeight), 'center' when collapsed
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Expanded state (height > minHeight)
|
|
93
|
+
* getIconAlignment(100, 40) // returns 'flex-start'
|
|
94
|
+
*
|
|
95
|
+
* // Collapsed state (height === minHeight)
|
|
96
|
+
* getIconAlignment(40, 40) // returns 'center'
|
|
97
|
+
*
|
|
98
|
+
* **Validates: Requirements 3.1, 3.2, 3.3**
|
|
99
|
+
*/
|
|
100
|
+
export function getIconAlignment(
|
|
101
|
+
currentHeight: number,
|
|
102
|
+
minHeight: number
|
|
103
|
+
): 'flex-start' | 'center' {
|
|
104
|
+
// Input validation: handle negative or zero values
|
|
105
|
+
const validCurrentHeight = Math.max(0, currentHeight);
|
|
106
|
+
const validMinHeight = Math.max(1, minHeight);
|
|
107
|
+
|
|
108
|
+
return validCurrentHeight > validMinHeight ? 'flex-start' : 'center';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Configuration options for resolving effective max height.
|
|
113
|
+
*/
|
|
114
|
+
export interface MaxHeightConfig {
|
|
115
|
+
/**
|
|
116
|
+
* Maximum number of lines before scrolling is enabled.
|
|
117
|
+
* Used to calculate maxHeight if maxHeight is not explicitly provided.
|
|
118
|
+
*/
|
|
119
|
+
maxLines?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Maximum height in pixels. Takes precedence over maxLines if provided.
|
|
122
|
+
*/
|
|
123
|
+
maxHeight?: number;
|
|
124
|
+
/**
|
|
125
|
+
* Line height for text (used in maxLines calculation).
|
|
126
|
+
* @default DEFAULT_LINE_HEIGHT
|
|
127
|
+
*/
|
|
128
|
+
lineHeight?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Vertical padding (used in maxLines calculation).
|
|
131
|
+
* @default DEFAULT_PADDING_VERTICAL
|
|
132
|
+
*/
|
|
133
|
+
paddingVertical?: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Pure function to resolve the effective maximum height based on configuration.
|
|
138
|
+
* When both maxLines and maxHeight are provided, maxHeight takes precedence.
|
|
139
|
+
*
|
|
140
|
+
* @param config - Configuration object with maxLines and/or maxHeight
|
|
141
|
+
* @returns The effective maximum height in pixels
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* // maxHeight takes precedence over maxLines
|
|
145
|
+
* resolveEffectiveMaxHeight({ maxLines: 5, maxHeight: 100 }) // returns 100
|
|
146
|
+
*
|
|
147
|
+
* // maxLines is used when maxHeight is not provided
|
|
148
|
+
* resolveEffectiveMaxHeight({ maxLines: 5 }) // returns 144 (5 * 24 + 12 * 2)
|
|
149
|
+
*
|
|
150
|
+
* // Default values when neither is provided
|
|
151
|
+
* resolveEffectiveMaxHeight({}) // returns DEFAULT_MAX_HEIGHT
|
|
152
|
+
*
|
|
153
|
+
* **Validates: Requirements 2.2, 2.3**
|
|
154
|
+
*/
|
|
155
|
+
export function resolveEffectiveMaxHeight(config: MaxHeightConfig): number {
|
|
156
|
+
const {
|
|
157
|
+
maxLines,
|
|
158
|
+
maxHeight,
|
|
159
|
+
lineHeight = DEFAULT_LINE_HEIGHT,
|
|
160
|
+
paddingVertical = DEFAULT_PADDING_VERTICAL,
|
|
161
|
+
} = config;
|
|
162
|
+
|
|
163
|
+
// If maxHeight is explicitly provided (not undefined), it takes precedence
|
|
164
|
+
if (maxHeight !== undefined) {
|
|
165
|
+
// Validate maxHeight: must be positive
|
|
166
|
+
return Math.max(1, maxHeight);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// If maxLines is provided, calculate maxHeight from it
|
|
170
|
+
if (maxLines !== undefined) {
|
|
171
|
+
return calculateMaxHeightFromLines(maxLines, lineHeight, paddingVertical);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Default: use DEFAULT_MAX_HEIGHT
|
|
175
|
+
return DEFAULT_MAX_HEIGHT;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Pure function to determine if height state should be updated.
|
|
180
|
+
* Returns true only when the new calculated height differs from the current height.
|
|
181
|
+
* This optimization prevents unnecessary re-renders when height doesn't change.
|
|
182
|
+
*
|
|
183
|
+
* @param newHeight - The newly calculated height from content size change
|
|
184
|
+
* @param currentHeight - The current height state value
|
|
185
|
+
* @returns true if height should be updated, false otherwise
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* // Height changed - should update
|
|
189
|
+
* shouldUpdateHeight(100, 40) // returns true
|
|
190
|
+
*
|
|
191
|
+
* // Height unchanged - should not update
|
|
192
|
+
* shouldUpdateHeight(40, 40) // returns false
|
|
193
|
+
*
|
|
194
|
+
* // Floating point comparison with tolerance
|
|
195
|
+
* shouldUpdateHeight(40.0001, 40) // returns false (within tolerance)
|
|
196
|
+
*
|
|
197
|
+
* **Validates: Requirements 7.2**
|
|
198
|
+
*/
|
|
199
|
+
export function shouldUpdateHeight(newHeight: number, currentHeight: number): boolean {
|
|
200
|
+
// Use a small tolerance for floating point comparison to avoid
|
|
201
|
+
// unnecessary updates due to floating point precision issues
|
|
202
|
+
const TOLERANCE = 0.001;
|
|
203
|
+
return Math.abs(newHeight - currentHeight) > TOLERANCE;
|
|
204
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CometChatCompactMessageComposer,
|
|
3
|
+
CometChatCompactMessageComposerInterface,
|
|
4
|
+
SingleLineMessageComposerStyleInterface,
|
|
5
|
+
} from './CometChatCompactMessageComposer';
|
|
6
|
+
import {
|
|
7
|
+
SingleLineMessageComposerConfiguration,
|
|
8
|
+
SingleLineMessageComposerConfigurationInterface,
|
|
9
|
+
SingleLineMessageComposerDefaults,
|
|
10
|
+
SingleLineMessageComposerStyleDefaults,
|
|
11
|
+
SingleLineMessageComposerLayoutDefaults,
|
|
12
|
+
getThemeStyleDefaults,
|
|
13
|
+
} from './SingleLineTextComposerConfiguration';
|
|
14
|
+
import {
|
|
15
|
+
calculateInputHeight,
|
|
16
|
+
calculateMaxHeightFromLines,
|
|
17
|
+
getIconAlignment,
|
|
18
|
+
DEFAULT_MIN_HEIGHT,
|
|
19
|
+
DEFAULT_MAX_HEIGHT,
|
|
20
|
+
DEFAULT_LINE_HEIGHT,
|
|
21
|
+
DEFAULT_MAX_LINES,
|
|
22
|
+
DEFAULT_PADDING_VERTICAL,
|
|
23
|
+
} from './heightUtils';
|
|
24
|
+
import {
|
|
25
|
+
Style,
|
|
26
|
+
MIN_INPUT_HEIGHT,
|
|
27
|
+
SingleLineComposerStyle,
|
|
28
|
+
getSingleLineComposerStyle,
|
|
29
|
+
} from './styles';
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
CometChatCompactMessageComposer,
|
|
33
|
+
SingleLineMessageComposerConfiguration,
|
|
34
|
+
SingleLineMessageComposerConfigurationInterface,
|
|
35
|
+
CometChatCompactMessageComposerInterface,
|
|
36
|
+
SingleLineMessageComposerStyleInterface,
|
|
37
|
+
// Default values exports
|
|
38
|
+
SingleLineMessageComposerDefaults,
|
|
39
|
+
SingleLineMessageComposerStyleDefaults,
|
|
40
|
+
SingleLineMessageComposerLayoutDefaults,
|
|
41
|
+
getThemeStyleDefaults,
|
|
42
|
+
// Height calculation utilities
|
|
43
|
+
calculateInputHeight,
|
|
44
|
+
calculateMaxHeightFromLines,
|
|
45
|
+
getIconAlignment,
|
|
46
|
+
DEFAULT_MIN_HEIGHT,
|
|
47
|
+
DEFAULT_MAX_HEIGHT,
|
|
48
|
+
DEFAULT_LINE_HEIGHT,
|
|
49
|
+
DEFAULT_MAX_LINES,
|
|
50
|
+
DEFAULT_PADDING_VERTICAL,
|
|
51
|
+
// Style exports
|
|
52
|
+
Style,
|
|
53
|
+
MIN_INPUT_HEIGHT,
|
|
54
|
+
SingleLineComposerStyle,
|
|
55
|
+
getSingleLineComposerStyle,
|
|
56
|
+
};
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ColorValue,
|
|
3
|
+
ImageSourcePropType,
|
|
4
|
+
ImageStyle,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TextStyle,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { ActionSheetStyle, CometChatTheme } from "../theme/type";
|
|
10
|
+
import { DeepPartial } from "../shared/helper/types";
|
|
11
|
+
import { JSX } from "react";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Constants for auto-expanding TextInput height calculations.
|
|
15
|
+
* These are exported for use in component logic and style calculations.
|
|
16
|
+
*
|
|
17
|
+
* @see heightUtils.ts for calculation functions
|
|
18
|
+
*/
|
|
19
|
+
export const MIN_INPUT_HEIGHT = 24;
|
|
20
|
+
export const DEFAULT_LINE_HEIGHT = 24;
|
|
21
|
+
|
|
22
|
+
export const Style = StyleSheet.create({
|
|
23
|
+
// Outer wrapper with padding (matches Figma: pb-8, px-8)
|
|
24
|
+
wrapper: {
|
|
25
|
+
paddingTop: 0,
|
|
26
|
+
paddingBottom: 8,
|
|
27
|
+
paddingHorizontal: 8,
|
|
28
|
+
},
|
|
29
|
+
// Main container with border and rounded corners (matches Figma: Base_Message Composer)
|
|
30
|
+
container: {
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
borderWidth: 1,
|
|
33
|
+
borderRadius: 8,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
},
|
|
36
|
+
// Input row with icons and text input (matches Figma: Top Field)
|
|
37
|
+
inputRow: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
paddingHorizontal: 12,
|
|
41
|
+
paddingVertical: 12,
|
|
42
|
+
},
|
|
43
|
+
// Expanded input row variant - icons align to top when input is expanded
|
|
44
|
+
expandedInputRow: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'flex-start',
|
|
47
|
+
paddingHorizontal: 12,
|
|
48
|
+
paddingVertical: 12,
|
|
49
|
+
},
|
|
50
|
+
// Left icons container (matches Figma: Icons left)
|
|
51
|
+
leftIconsContainer: {
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
marginRight: 12,
|
|
55
|
+
},
|
|
56
|
+
// Left icons container - top aligned for expanded state
|
|
57
|
+
leftIconsContainerTop: {
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
alignItems: 'flex-start',
|
|
60
|
+
marginRight: 12,
|
|
61
|
+
paddingTop: 0,
|
|
62
|
+
},
|
|
63
|
+
// Right icons container with spacing (matches Figma: Icons right - gap 16px)
|
|
64
|
+
rightIconsContainer: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
marginLeft: 12,
|
|
68
|
+
gap: 16,
|
|
69
|
+
},
|
|
70
|
+
// Right icons container - top aligned for expanded state
|
|
71
|
+
rightIconsContainerTop: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'flex-start',
|
|
74
|
+
marginLeft: 12,
|
|
75
|
+
paddingTop: 0,
|
|
76
|
+
gap: 16,
|
|
77
|
+
},
|
|
78
|
+
// Text input - flex to fill available space (matches Figma: Placeholder)
|
|
79
|
+
textInput: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
lineHeight: DEFAULT_LINE_HEIGHT,
|
|
83
|
+
padding: 0,
|
|
84
|
+
margin: 0,
|
|
85
|
+
minHeight: MIN_INPUT_HEIGHT,
|
|
86
|
+
},
|
|
87
|
+
// Text input for auto-expand mode - supports dynamic height
|
|
88
|
+
textInputAutoExpand: {
|
|
89
|
+
flex: 1,
|
|
90
|
+
fontSize: 14,
|
|
91
|
+
lineHeight: DEFAULT_LINE_HEIGHT,
|
|
92
|
+
padding: 0,
|
|
93
|
+
margin: 0,
|
|
94
|
+
minHeight: MIN_INPUT_HEIGHT,
|
|
95
|
+
textAlignVertical: 'top',
|
|
96
|
+
},
|
|
97
|
+
// Icon button touchable area
|
|
98
|
+
iconButton: {
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
minWidth: 24,
|
|
102
|
+
minHeight: 24,
|
|
103
|
+
},
|
|
104
|
+
// ImageButton base style
|
|
105
|
+
imageButtonBase: {
|
|
106
|
+
minWidth: 24,
|
|
107
|
+
minHeight: 24,
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
},
|
|
111
|
+
// Icon size (matches Figma: 24x24)
|
|
112
|
+
icon: {
|
|
113
|
+
height: 24,
|
|
114
|
+
width: 24,
|
|
115
|
+
minHeight: 24,
|
|
116
|
+
minWidth: 24,
|
|
117
|
+
},
|
|
118
|
+
// Separator line (matches Figma: Seprator)
|
|
119
|
+
separator: {
|
|
120
|
+
height: 1,
|
|
121
|
+
width: '100%',
|
|
122
|
+
},
|
|
123
|
+
// Auxiliary container for custom buttons
|
|
124
|
+
auxiliaryContainer: {
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
},
|
|
128
|
+
// Live reaction styles
|
|
129
|
+
liveReactionStyle: {
|
|
130
|
+
alignItems: 'flex-end',
|
|
131
|
+
},
|
|
132
|
+
liveReactionBtnStyle: {
|
|
133
|
+
height: 24,
|
|
134
|
+
width: 24,
|
|
135
|
+
resizeMode: 'stretch',
|
|
136
|
+
},
|
|
137
|
+
// Legacy aliases for backward compatibility
|
|
138
|
+
sendButton: {
|
|
139
|
+
justifyContent: 'center',
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
},
|
|
142
|
+
sendIcon: {
|
|
143
|
+
height: 24,
|
|
144
|
+
width: 24,
|
|
145
|
+
},
|
|
146
|
+
// Mention suggestion list container
|
|
147
|
+
mentionListContainer: {
|
|
148
|
+
borderTopWidth: 1,
|
|
149
|
+
paddingVertical: 5,
|
|
150
|
+
paddingHorizontal: 0,
|
|
151
|
+
justifyContent: 'flex-end',
|
|
152
|
+
zIndex: 1,
|
|
153
|
+
},
|
|
154
|
+
// Mention limit warning container
|
|
155
|
+
mentionLimitContainer: {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
alignItems: 'center',
|
|
158
|
+
paddingTop: 5,
|
|
159
|
+
paddingLeft: 5,
|
|
160
|
+
borderTopWidth: 1,
|
|
161
|
+
},
|
|
162
|
+
// Mention limit icon
|
|
163
|
+
mentionLimitIcon: {
|
|
164
|
+
height: 20,
|
|
165
|
+
width: 20,
|
|
166
|
+
},
|
|
167
|
+
// Mention limit text
|
|
168
|
+
mentionLimitText: {
|
|
169
|
+
marginLeft: 5,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const getAttachmentOptionsStyle = (
|
|
174
|
+
color: CometChatTheme["color"],
|
|
175
|
+
spacing: CometChatTheme["spacing"],
|
|
176
|
+
typography: CometChatTheme["typography"]
|
|
177
|
+
): ActionSheetStyle => {
|
|
178
|
+
return {
|
|
179
|
+
optionsItemStyle: {
|
|
180
|
+
containerStyle: {
|
|
181
|
+
paddingVertical: spacing.padding.p3,
|
|
182
|
+
paddingHorizontal: spacing.padding.p4,
|
|
183
|
+
backgroundColor: color.background1,
|
|
184
|
+
flexDirection: "row",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
gap: 5,
|
|
187
|
+
},
|
|
188
|
+
titleStyle: {
|
|
189
|
+
...typography.body.regular,
|
|
190
|
+
color: color.textPrimary,
|
|
191
|
+
paddingLeft: spacing.padding.p1,
|
|
192
|
+
},
|
|
193
|
+
iconStyle: {
|
|
194
|
+
height: 24,
|
|
195
|
+
width: 24,
|
|
196
|
+
},
|
|
197
|
+
iconContainerStyle: {},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export type SingleLineComposerStyle = {
|
|
203
|
+
containerStyle: ViewStyle;
|
|
204
|
+
sendIcon?: ImageSourcePropType | JSX.Element;
|
|
205
|
+
sendIconStyle: ImageStyle;
|
|
206
|
+
sendIconContainerStyle: ViewStyle;
|
|
207
|
+
attachmentIcon?: ImageSourcePropType | JSX.Element;
|
|
208
|
+
attachmentIconStyle: ImageStyle;
|
|
209
|
+
voiceRecordingIcon: ImageSourcePropType | JSX.Element;
|
|
210
|
+
voiceRecordingIconStyle: ImageStyle;
|
|
211
|
+
messageInputStyles: {
|
|
212
|
+
containerStyle: ViewStyle;
|
|
213
|
+
textStyle: TextStyle;
|
|
214
|
+
placeHolderTextColor?: ColorValue | undefined;
|
|
215
|
+
dividerStyle: ViewStyle;
|
|
216
|
+
};
|
|
217
|
+
mentionsStyle: CometChatTheme["mentionsStyle"];
|
|
218
|
+
stickerIcon: {
|
|
219
|
+
active: ImageSourcePropType | JSX.Element;
|
|
220
|
+
inactive: ImageSourcePropType | JSX.Element;
|
|
221
|
+
};
|
|
222
|
+
stickerIconStyle: {
|
|
223
|
+
active: ImageStyle;
|
|
224
|
+
inactive: ImageStyle;
|
|
225
|
+
};
|
|
226
|
+
mediaRecorderStyle: CometChatTheme["mediaRecorderStyle"];
|
|
227
|
+
attachmentOptionsStyles: ActionSheetStyle;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const getSingleLineComposerStyle = (
|
|
231
|
+
color: CometChatTheme["color"],
|
|
232
|
+
spacing: CometChatTheme["spacing"],
|
|
233
|
+
typography: CometChatTheme["typography"]
|
|
234
|
+
): DeepPartial<SingleLineComposerStyle> => {
|
|
235
|
+
return {
|
|
236
|
+
containerStyle: {
|
|
237
|
+
backgroundColor: color.background3,
|
|
238
|
+
width: "100%",
|
|
239
|
+
},
|
|
240
|
+
messageInputStyles: {
|
|
241
|
+
containerStyle: {
|
|
242
|
+
borderRadius: spacing.radius.r2,
|
|
243
|
+
borderWidth: spacing.spacing.s0_5 / 2,
|
|
244
|
+
borderColor: color.borderDefault,
|
|
245
|
+
backgroundColor: color.background1,
|
|
246
|
+
},
|
|
247
|
+
textStyle: {
|
|
248
|
+
padding: spacing.padding.p3,
|
|
249
|
+
paddingBottom: spacing.padding.p2,
|
|
250
|
+
color: color.textPrimary,
|
|
251
|
+
maxHeight: spacing.spacing.s20,
|
|
252
|
+
...typography.body.regular,
|
|
253
|
+
},
|
|
254
|
+
placeHolderTextColor: color.textTertiary,
|
|
255
|
+
dividerStyle: {
|
|
256
|
+
height: 1,
|
|
257
|
+
backgroundColor: color.borderLight,
|
|
258
|
+
marginVertical: spacing.margin.m1,
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
attachmentIconStyle: {
|
|
262
|
+
tintColor: color.iconSecondary,
|
|
263
|
+
height: spacing.spacing.s6,
|
|
264
|
+
width: spacing.spacing.s6,
|
|
265
|
+
},
|
|
266
|
+
voiceRecordingIconStyle: {
|
|
267
|
+
tintColor: color.iconSecondary,
|
|
268
|
+
height: spacing.spacing.s6,
|
|
269
|
+
width: spacing.spacing.s6,
|
|
270
|
+
},
|
|
271
|
+
mentionsStyle: {
|
|
272
|
+
textStyle: {
|
|
273
|
+
...typography.body.regular,
|
|
274
|
+
color: color.textHighlight,
|
|
275
|
+
},
|
|
276
|
+
selfTextStyle: {
|
|
277
|
+
...typography.body.regular,
|
|
278
|
+
color: color.warning,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
stickerIconStyle: {
|
|
282
|
+
inactive: {
|
|
283
|
+
tintColor: color.iconSecondary,
|
|
284
|
+
},
|
|
285
|
+
active: {
|
|
286
|
+
tintColor: color.primary,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
attachmentOptionsStyles: getAttachmentOptionsStyle(color, spacing, typography),
|
|
290
|
+
};
|
|
291
|
+
};
|