stream-chat-react-native-core 5.32.0-beta.2 → 5.32.0
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/lib/commonjs/components/Channel/Channel.js +7 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
- package/lib/commonjs/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +8 -8
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js +21 -18
- package/lib/commonjs/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js +14 -12
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +4 -28
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageSystem.js +14 -8
- package/lib/commonjs/components/MessageList/MessageSystem.js.map +1 -1
- package/lib/commonjs/components/MessageList/StickyHeader.js +36 -0
- package/lib/commonjs/components/MessageList/StickyHeader.js.map +1 -0
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/hooks/useStreami18n.js +1 -1
- package/lib/commonjs/i18n/en.json +7 -0
- package/lib/commonjs/i18n/es.json +7 -0
- package/lib/commonjs/i18n/fr.json +7 -0
- package/lib/commonjs/i18n/he.json +7 -0
- package/lib/commonjs/i18n/hi.json +7 -0
- package/lib/commonjs/i18n/it.json +7 -0
- package/lib/commonjs/i18n/ja.json +7 -0
- package/lib/commonjs/i18n/ko.json +7 -0
- package/lib/commonjs/i18n/nl.json +7 -0
- package/lib/commonjs/i18n/pt-br.json +7 -0
- package/lib/commonjs/i18n/ru.json +7 -0
- package/lib/commonjs/i18n/tr.json +7 -0
- package/lib/commonjs/index.js +2 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/{Streami18n.js → i18n/Streami18n.js} +61 -68
- package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -0
- package/lib/commonjs/utils/i18n/calendarFormats.js +104 -0
- package/lib/commonjs/utils/i18n/calendarFormats.js.map +1 -0
- package/lib/commonjs/utils/i18n/getDateString.js +47 -0
- package/lib/commonjs/utils/i18n/getDateString.js.map +1 -0
- package/lib/commonjs/utils/i18n/predefinedFormatters.js +40 -0
- package/lib/commonjs/utils/i18n/predefinedFormatters.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Channel/Channel.js +7 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +18 -3
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -17
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +9 -6
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js +4 -5
- package/lib/module/components/Message/MessageSimple/MessageEditedTimestamp.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +8 -8
- package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTimestamp.js +21 -18
- package/lib/module/components/Message/MessageSimple/MessageTimestamp.js.map +1 -1
- package/lib/module/components/MessageList/InlineDateSeparator.js +14 -12
- package/lib/module/components/MessageList/InlineDateSeparator.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +4 -28
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/MessageSystem.js +14 -8
- package/lib/module/components/MessageList/MessageSystem.js.map +1 -1
- package/lib/module/components/MessageList/StickyHeader.js +36 -0
- package/lib/module/components/MessageList/StickyHeader.js.map +1 -0
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/hooks/useStreami18n.js +1 -1
- package/lib/module/i18n/en.json +7 -0
- package/lib/module/i18n/es.json +7 -0
- package/lib/module/i18n/fr.json +7 -0
- package/lib/module/i18n/he.json +7 -0
- package/lib/module/i18n/hi.json +7 -0
- package/lib/module/i18n/it.json +7 -0
- package/lib/module/i18n/ja.json +7 -0
- package/lib/module/i18n/ko.json +7 -0
- package/lib/module/i18n/nl.json +7 -0
- package/lib/module/i18n/pt-br.json +7 -0
- package/lib/module/i18n/ru.json +7 -0
- package/lib/module/i18n/tr.json +7 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/{Streami18n.js → i18n/Streami18n.js} +61 -68
- package/lib/module/utils/i18n/Streami18n.js.map +1 -0
- package/lib/module/utils/i18n/calendarFormats.js +104 -0
- package/lib/module/utils/i18n/calendarFormats.js.map +1 -0
- package/lib/module/utils/i18n/getDateString.js +47 -0
- package/lib/module/utils/i18n/getDateString.js.map +1 -0
- package/lib/module/utils/i18n/predefinedFormatters.js +40 -0
- package/lib/module/utils/i18n/predefinedFormatters.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryHeader.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts +2 -2
- package/lib/typescript/components/Message/MessageSimple/MessageEditedTimestamp.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts +2 -13
- package/lib/typescript/components/Message/MessageSimple/MessageTimestamp.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/components/MessageList/DateHeader.d.ts +1 -1
- package/lib/typescript/components/MessageList/DateHeader.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts +7 -1
- package/lib/typescript/components/MessageList/InlineDateSeparator.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -2
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageSystem.d.ts +3 -0
- package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/StickyHeader.d.ts +18 -0
- package/lib/typescript/components/MessageList/StickyHeader.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +2 -3
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +6 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts.map +1 -1
- package/lib/typescript/hooks/useStreami18n.d.ts +1 -1
- package/lib/typescript/hooks/useStreami18n.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +7 -0
- package/lib/typescript/i18n/es.json +7 -0
- package/lib/typescript/i18n/fr.json +7 -0
- package/lib/typescript/i18n/he.json +7 -0
- package/lib/typescript/i18n/hi.json +7 -0
- package/lib/typescript/i18n/it.json +7 -0
- package/lib/typescript/i18n/ja.json +7 -0
- package/lib/typescript/i18n/ko.json +7 -0
- package/lib/typescript/i18n/nl.json +7 -0
- package/lib/typescript/i18n/pt-br.json +7 -0
- package/lib/typescript/i18n/ru.json +7 -0
- package/lib/typescript/i18n/tr.json +7 -0
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/{Streami18n.d.ts → i18n/Streami18n.d.ts} +16 -5
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/calendarFormats.d.ts +14 -0
- package/lib/typescript/utils/i18n/calendarFormats.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/getDateString.d.ts +16 -0
- package/lib/typescript/utils/i18n/getDateString.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/predefinedFormatters.d.ts +13 -0
- package/lib/typescript/utils/i18n/predefinedFormatters.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/components/Attachment/__tests__/Giphy.test.js +1 -1
- package/src/components/Channel/Channel.tsx +6 -1
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +16 -2
- package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +7 -28
- package/src/components/Chat/Chat.tsx +1 -1
- package/src/components/Chat/__tests__/Chat.test.js +1 -1
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +13 -3
- package/src/components/Message/MessageSimple/MessageEditedTimestamp.tsx +10 -5
- package/src/components/Message/MessageSimple/MessageFooter.tsx +10 -7
- package/src/components/Message/MessageSimple/MessageTimestamp.tsx +20 -29
- package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +1 -1
- package/src/components/MessageList/DateHeader.tsx +1 -1
- package/src/components/MessageList/InlineDateSeparator.tsx +20 -15
- package/src/components/MessageList/MessageList.tsx +4 -31
- package/src/components/MessageList/MessageSystem.tsx +20 -8
- package/src/components/MessageList/StickyHeader.tsx +42 -0
- package/src/components/MessageList/__tests__/MessageSystem.test.js +8 -3
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.js +1 -1
- package/src/components/MessageList/__tests__/TypingIndicator.test.js +1 -1
- package/src/components/Thread/__tests__/Thread.test.js +1 -1
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +1 -1
- package/src/components/index.ts +1 -0
- package/src/contexts/channelContext/ChannelContext.tsx +2 -1
- package/src/contexts/messagesContext/MessagesContext.tsx +6 -0
- package/src/contexts/overlayContext/OverlayContext.tsx +1 -1
- package/src/hooks/useStreami18n.ts +1 -1
- package/src/i18n/en.json +7 -0
- package/src/i18n/es.json +7 -0
- package/src/i18n/fr.json +7 -0
- package/src/i18n/he.json +7 -0
- package/src/i18n/hi.json +7 -0
- package/src/i18n/it.json +7 -0
- package/src/i18n/ja.json +7 -0
- package/src/i18n/ko.json +7 -0
- package/src/i18n/nl.json +7 -0
- package/src/i18n/pt-br.json +7 -0
- package/src/i18n/ru.json +7 -0
- package/src/i18n/tr.json +7 -0
- package/src/index.ts +4 -1
- package/src/utils/__tests__/Streami18n.test.js +23 -1
- package/src/utils/{Streami18n.ts → i18n/Streami18n.ts} +60 -71
- package/src/utils/i18n/calendarFormats.ts +110 -0
- package/src/utils/i18n/getDateString.ts +76 -0
- package/src/utils/i18n/predefinedFormatters.ts +63 -0
- package/src/version.json +1 -1
- package/lib/commonjs/utils/Streami18n.js.map +0 -1
- package/lib/commonjs/utils/getDateString.js +0 -31
- package/lib/commonjs/utils/getDateString.js.map +0 -1
- package/lib/module/utils/Streami18n.js.map +0 -1
- package/lib/module/utils/getDateString.js +0 -31
- package/lib/module/utils/getDateString.js.map +0 -1
- package/lib/typescript/utils/Streami18n.d.ts.map +0 -1
- package/lib/typescript/utils/getDateString.d.ts +0 -30
- package/lib/typescript/utils/getDateString.d.ts.map +0 -1
- package/src/utils/getDateString.ts +0 -67
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** i18next polyfill to handle intl format for pluralization. For more info see https://www.i18next.com/misc/json-format#i-18-next-json-v4 */
|
|
2
|
+
import 'intl-pluralrules';
|
|
1
3
|
export * from './components';
|
|
2
4
|
export * from './hooks';
|
|
3
5
|
export { registerNativeHandlers, NetInfo, iOS14RefreshGallerySelection } from './native';
|
|
@@ -6,7 +8,7 @@ export * from './emoji-data';
|
|
|
6
8
|
export * from './icons';
|
|
7
9
|
export * from './types/types';
|
|
8
10
|
export * from './utils/patchMessageTextCommand';
|
|
9
|
-
export * from './utils/Streami18n';
|
|
11
|
+
export * from './utils/i18n/Streami18n';
|
|
10
12
|
export * from './utils/utils';
|
|
11
13
|
export * from './utils/StreamChatRN';
|
|
12
14
|
export { default as enTranslations } from './i18n/en.json';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACzF,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAE7B,cAAc,SAAS,CAAC;AAExB,cAAc,eAAe,CAAC;AAE9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,6IAA6I;AAC7I,OAAO,kBAAkB,CAAC;AAE1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACzF,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAE7B,cAAc,SAAS,CAAC;AAExB,cAAc,eAAe,CAAC;AAE9B,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,OAAO,KAAK,gBAAgB,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Dayjs from 'dayjs';
|
|
2
2
|
import { FallbackLng, TFunction } from 'i18next';
|
|
3
3
|
import type moment from 'moment';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { CustomFormatters, PredefinedFormatters } from './predefinedFormatters';
|
|
5
|
+
import type { TDateTimeParser } from '../../contexts/translationContext/TranslationContext';
|
|
6
|
+
import enTranslations from '../../i18n/en.json';
|
|
6
7
|
import 'dayjs/locale/es';
|
|
7
8
|
import 'dayjs/locale/fr';
|
|
8
9
|
import 'dayjs/locale/he';
|
|
@@ -20,12 +21,13 @@ import 'dayjs/locale/tr';
|
|
|
20
21
|
* sure we don't mess up languages in other places in the app.
|
|
21
22
|
*/
|
|
22
23
|
import 'dayjs/locale/en';
|
|
23
|
-
import type { DefaultStreamChatGenerics } from '
|
|
24
|
-
type
|
|
24
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
25
|
+
type Streami18nOptions = {
|
|
25
26
|
DateTimeParser?: typeof Dayjs | typeof moment;
|
|
26
27
|
dayjsLocaleConfigForLanguage?: Partial<ILocale>;
|
|
27
28
|
debug?: boolean;
|
|
28
29
|
disableDateTimeTranslations?: boolean;
|
|
30
|
+
formatters?: Partial<PredefinedFormatters> & CustomFormatters;
|
|
29
31
|
language?: string;
|
|
30
32
|
logger?: (msg?: string) => void;
|
|
31
33
|
translationsForLanguage?: Partial<typeof enTranslations>;
|
|
@@ -35,6 +37,7 @@ type I18NextConfig = {
|
|
|
35
37
|
fallbackLng: false | FallbackLng;
|
|
36
38
|
interpolation: {
|
|
37
39
|
escapeValue: boolean;
|
|
40
|
+
formatSeparator: string;
|
|
38
41
|
};
|
|
39
42
|
keySeparator: false | string;
|
|
40
43
|
lng: string;
|
|
@@ -71,6 +74,7 @@ export declare class Streami18n {
|
|
|
71
74
|
logger: (msg?: string) => void;
|
|
72
75
|
currentLanguage: string;
|
|
73
76
|
DateTimeParser: typeof Dayjs | typeof moment;
|
|
77
|
+
formatters: PredefinedFormatters & CustomFormatters;
|
|
74
78
|
isCustomDateTimeParser: boolean;
|
|
75
79
|
i18nextConfig: I18NextConfig;
|
|
76
80
|
/**
|
|
@@ -99,7 +103,7 @@ export declare class Streami18n {
|
|
|
99
103
|
*
|
|
100
104
|
* @param {*} options
|
|
101
105
|
*/
|
|
102
|
-
constructor(options?:
|
|
106
|
+
constructor(options?: Streami18nOptions, i18nextConfig?: Partial<I18NextConfig>);
|
|
103
107
|
/**
|
|
104
108
|
* Initializes the i18next instance with configuration (which enables natural language as default keys)
|
|
105
109
|
*/
|
|
@@ -189,6 +193,13 @@ export declare class Streami18n {
|
|
|
189
193
|
Video: string;
|
|
190
194
|
You: string;
|
|
191
195
|
"You can't send messages in this channel": string;
|
|
196
|
+
"timestamp/ChannelPreviewStatus": string;
|
|
197
|
+
"timestamp/ImageGalleryHeader": string;
|
|
198
|
+
"timestamp/InlineDateSeparator": string;
|
|
199
|
+
"timestamp/MessageEditedTimestamp": string;
|
|
200
|
+
"timestamp/MessageSystem": string;
|
|
201
|
+
"timestamp/MessageTimestamp": string;
|
|
202
|
+
"timestamp/StickyHeader": string;
|
|
192
203
|
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": string;
|
|
193
204
|
"{{ index }} of {{ photoLength }}": string;
|
|
194
205
|
"{{ replyCount }} Replies": string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Streami18n.d.ts","sourceRoot":"","sources":["../../../../src/utils/i18n/Streami18n.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type CalendarFormats = {
|
|
2
|
+
lastDay: string;
|
|
3
|
+
lastWeek: string;
|
|
4
|
+
nextDay: string;
|
|
5
|
+
nextWeek: string;
|
|
6
|
+
sameDay: string;
|
|
7
|
+
sameElse: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Calendar formats for different languages.
|
|
11
|
+
*/
|
|
12
|
+
export declare const calendarFormats: Record<string, CalendarFormats>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=calendarFormats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendarFormats.d.ts","sourceRoot":"","sources":["../../../../src/utils/i18n/calendarFormats.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAiG3D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TimestampFormatterOptions } from './predefinedFormatters';
|
|
2
|
+
import { TranslatorFunctions } from '../../contexts/translationContext/TranslationContext';
|
|
3
|
+
type DateFormatterOptions = TimestampFormatterOptions & Partial<TranslatorFunctions> & {
|
|
4
|
+
/**
|
|
5
|
+
* The timestamp to be formatted.
|
|
6
|
+
*/
|
|
7
|
+
date?: string | Date;
|
|
8
|
+
timestampTranslationKey?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const noParsingFunctionWarning = "MessageTimestamp was called but there is no datetime parsing function available";
|
|
11
|
+
/**
|
|
12
|
+
* Utility function to format the date string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDateString({ calendar, calendarFormats, date, format, t, tDateTimeParser, timestampTranslationKey, }: DateFormatterOptions): string | number | undefined;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=getDateString.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDateString.d.ts","sourceRoot":"","sources":["../../../../src/utils/i18n/getDateString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAEL,mBAAmB,EACpB,MAAM,sDAAsD,CAAC;AAE9D,KAAK,oBAAoB,GAAG,yBAAyB,GACnD,OAAO,CAAC,mBAAmB,CAAC,GAAG;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAIrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,wBAAwB,oFAC8C,CAAC;AAEpF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,eAAe,EACf,IAAI,EACJ,MAAM,EACN,CAAC,EACD,eAAe,EACf,uBAAuB,GACxB,EAAE,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CA0CpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Streami18n } from './Streami18n';
|
|
2
|
+
export type TimestampFormatterOptions = {
|
|
3
|
+
calendar?: boolean | null;
|
|
4
|
+
calendarFormats?: Record<string, string>;
|
|
5
|
+
format?: string;
|
|
6
|
+
};
|
|
7
|
+
export type FormatterFactory<V> = (streamI18n: Streami18n) => (value: V, lng: string | undefined, options: Record<string, unknown>) => string;
|
|
8
|
+
export type CustomFormatters = Record<string, FormatterFactory<any>>;
|
|
9
|
+
export type PredefinedFormatters = {
|
|
10
|
+
timestampFormatter: FormatterFactory<string | Date>;
|
|
11
|
+
};
|
|
12
|
+
export declare const predefinedFormatters: PredefinedFormatters;
|
|
13
|
+
//# sourceMappingURL=predefinedFormatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predefinedFormatters.d.ts","sourceRoot":"","sources":["../../../../src/utils/i18n/predefinedFormatters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,yBAAyB,GAAG;IAEtC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAChC,UAAU,EAAE,UAAU,KACnB,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;AAKrF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;AAErE,MAAM,MAAM,oBAAoB,GAAG;IACjC,kBAAkB,EAAE,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,oBAqClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.32.0
|
|
4
|
+
"version": "5.32.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -70,7 +70,8 @@
|
|
|
70
70
|
"@gorhom/bottom-sheet": "4.4.8",
|
|
71
71
|
"dayjs": "1.10.5",
|
|
72
72
|
"emoji-regex": "^10.3.0",
|
|
73
|
-
"i18next": "
|
|
73
|
+
"i18next": "^21.6.14",
|
|
74
|
+
"intl-pluralrules": "^2.0.1",
|
|
74
75
|
"linkifyjs": "^4.1.1",
|
|
75
76
|
"lodash-es": "4.17.21",
|
|
76
77
|
"mime-types": "^2.1.34",
|
|
@@ -23,7 +23,7 @@ import { generateMember } from '../../../mock-builders/generator/member';
|
|
|
23
23
|
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
24
24
|
import { generateUser } from '../../../mock-builders/generator/user';
|
|
25
25
|
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
26
|
-
import { Streami18n } from '../../../utils/Streami18n';
|
|
26
|
+
import { Streami18n } from '../../../utils/i18n/Streami18n';
|
|
27
27
|
import { ImageLoadingFailedIndicator } from '../../Attachment/ImageLoadingFailedIndicator';
|
|
28
28
|
import { ImageLoadingIndicator } from '../../Attachment/ImageLoadingIndicator';
|
|
29
29
|
import { Channel } from '../../Channel/Channel';
|
|
@@ -127,6 +127,7 @@ import { MessageReplies as MessageRepliesDefault } from '../Message/MessageSimpl
|
|
|
127
127
|
import { MessageRepliesAvatars as MessageRepliesAvatarsDefault } from '../Message/MessageSimple/MessageRepliesAvatars';
|
|
128
128
|
import { MessageSimple as MessageSimpleDefault } from '../Message/MessageSimple/MessageSimple';
|
|
129
129
|
import { MessageStatus as MessageStatusDefault } from '../Message/MessageSimple/MessageStatus';
|
|
130
|
+
import { MessageTimestamp as MessageTimestampDefault } from '../Message/MessageSimple/MessageTimestamp';
|
|
130
131
|
import { ReactionList as ReactionListDefault } from '../Message/MessageSimple/ReactionList';
|
|
131
132
|
import { AttachButton as AttachButtonDefault } from '../MessageInput/AttachButton';
|
|
132
133
|
import { CommandsButton as CommandsButtonDefault } from '../MessageInput/CommandsButton';
|
|
@@ -156,6 +157,7 @@ import { MessageList as MessageListDefault } from '../MessageList/MessageList';
|
|
|
156
157
|
import { MessageSystem as MessageSystemDefault } from '../MessageList/MessageSystem';
|
|
157
158
|
import { NetworkDownIndicator as NetworkDownIndicatorDefault } from '../MessageList/NetworkDownIndicator';
|
|
158
159
|
import { ScrollToBottomButton as ScrollToBottomButtonDefault } from '../MessageList/ScrollToBottomButton';
|
|
160
|
+
import { StickyHeader as StickyHeaderDefault } from '../MessageList/StickyHeader';
|
|
159
161
|
import { TypingIndicator as TypingIndicatorDefault } from '../MessageList/TypingIndicator';
|
|
160
162
|
import { TypingIndicatorContainer as TypingIndicatorContainerDefault } from '../MessageList/TypingIndicatorContainer';
|
|
161
163
|
import { OverlayReactionList as OverlayReactionListDefault } from '../MessageOverlay/OverlayReactionList';
|
|
@@ -305,6 +307,7 @@ export type ChannelPropsWithContext<
|
|
|
305
307
|
| 'MessageStatus'
|
|
306
308
|
| 'MessageSystem'
|
|
307
309
|
| 'MessageText'
|
|
310
|
+
| 'MessageTimestamp'
|
|
308
311
|
| 'myMessageTheme'
|
|
309
312
|
| 'onLongPressMessage'
|
|
310
313
|
| 'onPressInMessage'
|
|
@@ -542,6 +545,7 @@ const ChannelWithContext = <
|
|
|
542
545
|
MessageStatus = MessageStatusDefault,
|
|
543
546
|
MessageSystem = MessageSystemDefault,
|
|
544
547
|
MessageText,
|
|
548
|
+
MessageTimestamp = MessageTimestampDefault,
|
|
545
549
|
MoreOptionsButton = MoreOptionsButtonDefault,
|
|
546
550
|
myMessageTheme,
|
|
547
551
|
NetworkDownIndicator = NetworkDownIndicatorDefault,
|
|
@@ -573,7 +577,7 @@ const ChannelWithContext = <
|
|
|
573
577
|
ShowThreadMessageInChannelButton = ShowThreadMessageInChannelButtonDefault,
|
|
574
578
|
StartAudioRecordingButton = AudioRecordingButtonDefault,
|
|
575
579
|
stateUpdateThrottleInterval = defaultThrottleInterval,
|
|
576
|
-
StickyHeader,
|
|
580
|
+
StickyHeader = StickyHeaderDefault,
|
|
577
581
|
supportedReactions = reactionData,
|
|
578
582
|
t,
|
|
579
583
|
thread: threadProps,
|
|
@@ -2328,6 +2332,7 @@ const ChannelWithContext = <
|
|
|
2328
2332
|
MessageStatus,
|
|
2329
2333
|
MessageSystem,
|
|
2330
2334
|
MessageText,
|
|
2335
|
+
MessageTimestamp,
|
|
2331
2336
|
myMessageTheme,
|
|
2332
2337
|
onLongPressMessage,
|
|
2333
2338
|
onPressInMessage,
|
|
@@ -69,6 +69,7 @@ export const useCreateMessagesContext = <
|
|
|
69
69
|
MessageStatus,
|
|
70
70
|
MessageSystem,
|
|
71
71
|
MessageText,
|
|
72
|
+
MessageTimestamp,
|
|
72
73
|
myMessageTheme,
|
|
73
74
|
onLongPressMessage,
|
|
74
75
|
onPressInMessage,
|
|
@@ -165,6 +166,7 @@ export const useCreateMessagesContext = <
|
|
|
165
166
|
MessageStatus,
|
|
166
167
|
MessageSystem,
|
|
167
168
|
MessageText,
|
|
169
|
+
MessageTimestamp,
|
|
168
170
|
myMessageTheme,
|
|
169
171
|
onLongPressMessage,
|
|
170
172
|
onPressInMessage,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { ChannelPreviewProps } from './ChannelPreview';
|
|
@@ -6,9 +6,11 @@ import type { ChannelPreviewMessengerPropsWithContext } from './ChannelPreviewMe
|
|
|
6
6
|
import { MessageReadStatus } from './hooks/useLatestMessagePreview';
|
|
7
7
|
|
|
8
8
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
9
|
+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
9
10
|
import { Check, CheckAll } from '../../icons';
|
|
10
11
|
|
|
11
12
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
13
|
+
import { getDateString } from '../../utils/i18n/getDateString';
|
|
12
14
|
|
|
13
15
|
const styles = StyleSheet.create({
|
|
14
16
|
date: {
|
|
@@ -35,6 +37,7 @@ export const ChannelPreviewStatus = <
|
|
|
35
37
|
props: ChannelPreviewStatusProps<StreamChatGenerics>,
|
|
36
38
|
) => {
|
|
37
39
|
const { formatLatestMessageDate, latestMessagePreview } = props;
|
|
40
|
+
const { t, tDateTimeParser } = useTranslationContext();
|
|
38
41
|
const {
|
|
39
42
|
theme: {
|
|
40
43
|
channelPreview: { checkAllIcon, checkIcon, date },
|
|
@@ -44,6 +47,17 @@ export const ChannelPreviewStatus = <
|
|
|
44
47
|
|
|
45
48
|
const created_at = latestMessagePreview.messageObject?.created_at;
|
|
46
49
|
const latestMessageDate = created_at ? new Date(created_at) : new Date();
|
|
50
|
+
|
|
51
|
+
const formattedDate = useMemo(
|
|
52
|
+
() =>
|
|
53
|
+
getDateString({
|
|
54
|
+
date: created_at,
|
|
55
|
+
t,
|
|
56
|
+
tDateTimeParser,
|
|
57
|
+
timestampTranslationKey: 'timestamp/ChannelPreviewStatus',
|
|
58
|
+
}),
|
|
59
|
+
[created_at, t, tDateTimeParser],
|
|
60
|
+
);
|
|
47
61
|
const status = latestMessagePreview.status;
|
|
48
62
|
|
|
49
63
|
return (
|
|
@@ -56,7 +70,7 @@ export const ChannelPreviewStatus = <
|
|
|
56
70
|
<Text style={[styles.date, { color: grey }, date]}>
|
|
57
71
|
{formatLatestMessageDate && latestMessageDate
|
|
58
72
|
? formatLatestMessageDate(latestMessageDate).toString()
|
|
59
|
-
:
|
|
73
|
+
: formattedDate}
|
|
60
74
|
</Text>
|
|
61
75
|
</View>
|
|
62
76
|
);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
+
import { TFunction } from 'i18next';
|
|
3
4
|
import type { Channel, ChannelState, MessageResponse, StreamChat, UserResponse } from 'stream-chat';
|
|
4
5
|
|
|
5
6
|
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
6
|
-
import {
|
|
7
|
-
isDayOrMoment,
|
|
8
|
-
TDateTimeParser,
|
|
9
|
-
useTranslationContext,
|
|
10
|
-
} from '../../../contexts/translationContext/TranslationContext';
|
|
7
|
+
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
11
8
|
|
|
12
9
|
import { useTranslatedMessage } from '../../../hooks/useTranslatedMessage';
|
|
13
10
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
@@ -21,13 +18,13 @@ type LatestMessage<
|
|
|
21
18
|
export type LatestMessagePreview<
|
|
22
19
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
23
20
|
> = {
|
|
24
|
-
created_at: string | number | Date;
|
|
25
21
|
messageObject: LatestMessage<StreamChatGenerics> | undefined;
|
|
26
22
|
previews: {
|
|
27
23
|
bold: boolean;
|
|
28
24
|
text: string;
|
|
29
25
|
}[];
|
|
30
26
|
status: number;
|
|
27
|
+
created_at?: string | Date;
|
|
31
28
|
};
|
|
32
29
|
|
|
33
30
|
const getMessageSenderName = <
|
|
@@ -131,22 +128,6 @@ const getLatestMessageDisplayText = <
|
|
|
131
128
|
];
|
|
132
129
|
};
|
|
133
130
|
|
|
134
|
-
const getLatestMessageDisplayDate = <
|
|
135
|
-
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
136
|
-
>(
|
|
137
|
-
message: LatestMessage<StreamChatGenerics> | undefined,
|
|
138
|
-
tDateTimeParser: TDateTimeParser,
|
|
139
|
-
) => {
|
|
140
|
-
const parserOutput = tDateTimeParser(message?.created_at);
|
|
141
|
-
if (isDayOrMoment(parserOutput)) {
|
|
142
|
-
if (parserOutput.isSame(new Date(), 'day')) {
|
|
143
|
-
return parserOutput.format('LT');
|
|
144
|
-
}
|
|
145
|
-
return parserOutput.format('L');
|
|
146
|
-
}
|
|
147
|
-
return parserOutput;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
131
|
export enum MessageReadStatus {
|
|
151
132
|
NOT_SENT_BY_CURRENT_USER = 0,
|
|
152
133
|
UNREAD = 1,
|
|
@@ -190,13 +171,12 @@ const getLatestMessagePreview = <
|
|
|
190
171
|
channel: Channel<StreamChatGenerics>;
|
|
191
172
|
client: StreamChat<StreamChatGenerics>;
|
|
192
173
|
readEvents: boolean;
|
|
193
|
-
t:
|
|
194
|
-
tDateTimeParser: TDateTimeParser;
|
|
174
|
+
t: TFunction;
|
|
195
175
|
lastMessage?:
|
|
196
176
|
| ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>
|
|
197
177
|
| MessageResponse<StreamChatGenerics>;
|
|
198
178
|
}) => {
|
|
199
|
-
const { channel, client, lastMessage, readEvents, t
|
|
179
|
+
const { channel, client, lastMessage, readEvents, t } = params;
|
|
200
180
|
|
|
201
181
|
const messages = channel.state.messages;
|
|
202
182
|
|
|
@@ -219,7 +199,7 @@ const getLatestMessagePreview = <
|
|
|
219
199
|
const message = lastMessage !== undefined ? lastMessage : channelStateLastMessage;
|
|
220
200
|
|
|
221
201
|
return {
|
|
222
|
-
created_at:
|
|
202
|
+
created_at: message?.created_at,
|
|
223
203
|
messageObject: message,
|
|
224
204
|
previews: getLatestMessageDisplayText(channel, client, message, t),
|
|
225
205
|
status: getLatestMessageReadStatus(channel, client, message, readEvents),
|
|
@@ -240,7 +220,7 @@ export const useLatestMessagePreview = <
|
|
|
240
220
|
forceUpdate: number,
|
|
241
221
|
) => {
|
|
242
222
|
const { client } = useChatContext<StreamChatGenerics>();
|
|
243
|
-
const { t
|
|
223
|
+
const { t } = useTranslationContext();
|
|
244
224
|
|
|
245
225
|
const channelConfigExists = typeof channel?.getConfig === 'function';
|
|
246
226
|
|
|
@@ -286,7 +266,6 @@ export const useLatestMessagePreview = <
|
|
|
286
266
|
lastMessage: translatedLastMessage,
|
|
287
267
|
readEvents,
|
|
288
268
|
t,
|
|
289
|
-
tDateTimeParser,
|
|
290
269
|
}),
|
|
291
270
|
),
|
|
292
271
|
[channelLastMessageString, forceUpdate, readEvents, readStatus],
|
|
@@ -27,8 +27,8 @@ import { SDK } from '../../native';
|
|
|
27
27
|
import { QuickSqliteClient } from '../../store/QuickSqliteClient';
|
|
28
28
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
29
29
|
import { DBSyncManager } from '../../utils/DBSyncManager';
|
|
30
|
+
import type { Streami18n } from '../../utils/i18n/Streami18n';
|
|
30
31
|
import { StreamChatRN } from '../../utils/StreamChatRN';
|
|
31
|
-
import type { Streami18n } from '../../utils/Streami18n';
|
|
32
32
|
import { version } from '../../version.json';
|
|
33
33
|
|
|
34
34
|
init();
|
|
@@ -10,7 +10,7 @@ import { useTranslationContext } from '../../../contexts/translationContext/Tran
|
|
|
10
10
|
import dispatchConnectionChangedEvent from '../../../mock-builders/event/connectionChanged';
|
|
11
11
|
import dispatchConnectionRecoveredEvent from '../../../mock-builders/event/connectionRecovered';
|
|
12
12
|
import { getTestClient } from '../../../mock-builders/mock';
|
|
13
|
-
import { Streami18n } from '../../../utils/Streami18n';
|
|
13
|
+
import { Streami18n } from '../../../utils/i18n/Streami18n';
|
|
14
14
|
import { Chat } from '../Chat';
|
|
15
15
|
|
|
16
16
|
const ChatContextConsumer = ({ fn }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { Pressable, SafeAreaView, StyleSheet, Text, View, ViewStyle } from 'react-native';
|
|
3
3
|
import Animated, { Extrapolate, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import { useTranslationContext } from '../../../contexts/translationContext/Tran
|
|
|
8
8
|
import { Close } from '../../../icons';
|
|
9
9
|
|
|
10
10
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
11
|
-
import { getDateString } from '../../../utils/getDateString';
|
|
11
|
+
import { getDateString } from '../../../utils/i18n/getDateString';
|
|
12
12
|
import type { Photo } from '../ImageGallery';
|
|
13
13
|
|
|
14
14
|
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
|
|
@@ -70,6 +70,7 @@ type Props<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamC
|
|
|
70
70
|
opacity: Animated.SharedValue<number>;
|
|
71
71
|
visible: Animated.SharedValue<number>;
|
|
72
72
|
photo?: Photo<StreamChatGenerics>;
|
|
73
|
+
/* Lookup key in the language corresponding translations sheet to perform date formatting */
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
export const ImageGalleryHeader = <
|
|
@@ -98,7 +99,16 @@ export const ImageGalleryHeader = <
|
|
|
98
99
|
const { t, tDateTimeParser } = useTranslationContext();
|
|
99
100
|
const { setOverlay } = useOverlayContext();
|
|
100
101
|
|
|
101
|
-
const date =
|
|
102
|
+
const date = useMemo(
|
|
103
|
+
() =>
|
|
104
|
+
getDateString({
|
|
105
|
+
date: photo?.created_at,
|
|
106
|
+
t,
|
|
107
|
+
tDateTimeParser,
|
|
108
|
+
timestampTranslationKey: 'timestamp/ImageGalleryHeader',
|
|
109
|
+
}),
|
|
110
|
+
[photo?.created_at, t, tDateTimeParser],
|
|
111
|
+
);
|
|
102
112
|
|
|
103
113
|
const headerStyle = useAnimatedStyle<ViewStyle>(() => ({
|
|
104
114
|
opacity: opacity.value,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import { MessageTimestamp, MessageTimestampProps } from './MessageTimestamp';
|
|
5
|
-
|
|
6
4
|
import {
|
|
7
5
|
MessageContextValue,
|
|
8
6
|
useMessageContext,
|
|
9
7
|
} from '../../../contexts/messageContext/MessageContext';
|
|
8
|
+
import { MessagesContextValue } from '../../../contexts/messagesContext/MessagesContext';
|
|
10
9
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
11
10
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
12
11
|
import { DefaultStreamChatGenerics } from '../../../types/types';
|
|
@@ -14,14 +13,15 @@ import { isEditedMessage } from '../../../utils/utils';
|
|
|
14
13
|
|
|
15
14
|
export type MessageEditedTimestampProps<
|
|
16
15
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
17
|
-
> = Partial<Pick<MessageContextValue<StreamChatGenerics>, 'message'>> &
|
|
16
|
+
> = Partial<Pick<MessageContextValue<StreamChatGenerics>, 'message'>> &
|
|
17
|
+
Partial<Pick<MessagesContextValue<StreamChatGenerics>, 'MessageTimestamp'>>;
|
|
18
18
|
|
|
19
19
|
export const MessageEditedTimestamp = <
|
|
20
20
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
21
21
|
>(
|
|
22
22
|
props: MessageEditedTimestampProps<StreamChatGenerics>,
|
|
23
23
|
) => {
|
|
24
|
-
const { message: propMessage,
|
|
24
|
+
const { message: propMessage, MessageTimestamp } = props;
|
|
25
25
|
const {
|
|
26
26
|
theme: {
|
|
27
27
|
colors: { grey },
|
|
@@ -41,7 +41,12 @@ export const MessageEditedTimestamp = <
|
|
|
41
41
|
return (
|
|
42
42
|
<View style={[styles.container, editedTimestampContainer]}>
|
|
43
43
|
<Text style={[styles.text, { color: grey }, editedLabel]}>{t<string>('Edited') + ' '}</Text>
|
|
44
|
-
|
|
44
|
+
{MessageTimestamp && (
|
|
45
|
+
<MessageTimestamp
|
|
46
|
+
timestamp={message.message_text_updated_at}
|
|
47
|
+
timestampTranslationKey='timestamp/MessageEditedTimestamp'
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
45
50
|
</View>
|
|
46
51
|
);
|
|
47
52
|
};
|
|
@@ -5,8 +5,6 @@ import type { Attachment } from 'stream-chat';
|
|
|
5
5
|
|
|
6
6
|
import type { MessageStatusProps } from './MessageStatus';
|
|
7
7
|
|
|
8
|
-
import { MessageTimestamp } from './MessageTimestamp';
|
|
9
|
-
|
|
10
8
|
import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
11
9
|
import {
|
|
12
10
|
Alignment,
|
|
@@ -46,7 +44,10 @@ type MessageFooterPropsWithContext<
|
|
|
46
44
|
> &
|
|
47
45
|
Pick<
|
|
48
46
|
MessagesContextValue<StreamChatGenerics>,
|
|
49
|
-
|
|
47
|
+
| 'deletedMessagesVisibilityType'
|
|
48
|
+
| 'MessageEditedTimestamp'
|
|
49
|
+
| 'MessageStatus'
|
|
50
|
+
| 'MessageTimestamp'
|
|
50
51
|
> &
|
|
51
52
|
MessageFooterComponentProps;
|
|
52
53
|
|
|
@@ -98,6 +99,7 @@ const MessageFooterWithContext = <
|
|
|
98
99
|
message,
|
|
99
100
|
MessageEditedTimestamp,
|
|
100
101
|
MessageStatus,
|
|
102
|
+
MessageTimestamp,
|
|
101
103
|
otherAttachments,
|
|
102
104
|
showMessageStatus,
|
|
103
105
|
} = props;
|
|
@@ -118,7 +120,7 @@ const MessageFooterWithContext = <
|
|
|
118
120
|
{deletedMessagesVisibilityType === 'sender' && (
|
|
119
121
|
<OnlyVisibleToYouComponent alignment={alignment} />
|
|
120
122
|
)}
|
|
121
|
-
<MessageTimestamp
|
|
123
|
+
<MessageTimestamp formattedDate={formattedDate} timestamp={date} />
|
|
122
124
|
</View>
|
|
123
125
|
);
|
|
124
126
|
}
|
|
@@ -137,7 +139,7 @@ const MessageFooterWithContext = <
|
|
|
137
139
|
<Text style={[styles.text, { color: grey }, messageUser]}>{message.user.name}</Text>
|
|
138
140
|
) : null}
|
|
139
141
|
{showMessageStatus && <MessageStatus />}
|
|
140
|
-
<MessageTimestamp
|
|
142
|
+
<MessageTimestamp formattedDate={formattedDate} timestamp={date} />
|
|
141
143
|
|
|
142
144
|
{isEditedMessage(message) && !isEditedMessageOpen && (
|
|
143
145
|
<>
|
|
@@ -160,7 +162,7 @@ const MessageFooterWithContext = <
|
|
|
160
162
|
)}
|
|
161
163
|
</View>
|
|
162
164
|
{isEditedMessageOpen && (
|
|
163
|
-
<MessageEditedTimestamp
|
|
165
|
+
<MessageEditedTimestamp message={message} MessageTimestamp={MessageTimestamp} />
|
|
164
166
|
)}
|
|
165
167
|
</>
|
|
166
168
|
);
|
|
@@ -270,7 +272,7 @@ export const MessageFooter = <
|
|
|
270
272
|
showMessageStatus,
|
|
271
273
|
} = useMessageContext<StreamChatGenerics>();
|
|
272
274
|
|
|
273
|
-
const { deletedMessagesVisibilityType, MessageEditedTimestamp, MessageStatus } =
|
|
275
|
+
const { deletedMessagesVisibilityType, MessageEditedTimestamp, MessageStatus, MessageTimestamp } =
|
|
274
276
|
useMessagesContext<StreamChatGenerics>();
|
|
275
277
|
|
|
276
278
|
return (
|
|
@@ -284,6 +286,7 @@ export const MessageFooter = <
|
|
|
284
286
|
message,
|
|
285
287
|
MessageEditedTimestamp,
|
|
286
288
|
MessageStatus,
|
|
289
|
+
MessageTimestamp,
|
|
287
290
|
otherAttachments,
|
|
288
291
|
showMessageStatus,
|
|
289
292
|
}}
|