stream-chat-react-native-core 4.7.2 → 4.8.0-beta.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/README.md +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +6 -16
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/i18n/he.json +67 -0
- package/lib/commonjs/index.js +9 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/Streami18n.js +5 -0
- package/lib/commonjs/utils/Streami18n.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +6 -16
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/i18n/he.json +67 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/Streami18n.js +5 -0
- package/lib/module/utils/Streami18n.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/ChannelList/ChannelList.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +5 -5
- package/lib/typescript/components/Thread/Thread.d.ts +4 -4
- package/lib/typescript/contexts/channelsContext/ChannelsContext.d.ts +7 -7
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +4 -4
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +5 -5
- package/lib/typescript/i18n/he.json +67 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/utils/Streami18n.d.ts +1 -4
- package/package.json +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
- package/src/components/ChannelList/ChannelList.tsx +1 -1
- package/src/components/MessageInput/MessageInput.tsx +5 -5
- package/src/components/MessageList/MessageList.tsx +5 -5
- package/src/components/Thread/Thread.tsx +4 -4
- package/src/contexts/channelsContext/ChannelsContext.tsx +7 -7
- package/src/contexts/messageInputContext/MessageInputContext.tsx +4 -4
- package/src/contexts/messagesContext/MessagesContext.tsx +5 -5
- package/src/i18n/he.json +67 -0
- package/src/index.ts +1 -0
- package/src/utils/Streami18n.ts +6 -3
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAmDA;;AAEA;;AACA;;;;;;;;;AA6ZO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.github.io/stream-chat-react-native/v3/#messagesystem)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.github.io/stream-chat-react-native/v3/#reply)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.github.io/stream-chat-react-native/v3/#ScrollToBottomButton)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.github.io/stream-chat-react-native/v3/#typingindicator)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.github.io/stream-chat-react-native/v3/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<StreamChatGenerics>>;\n\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\n legacyImageViewerSwipeBehaviour?: boolean;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["MessagesContext.tsx"],"names":["MessagesContext","React","createContext","DEFAULT_BASE_CONTEXT_VALUE","MessagesProvider","children","value","useMessagesContext","contextValue","Error","withMessagesContext","Component","WithMessagesContextComponent","props","messagesContext","displayName"],"mappings":";;;;;;;;;;;AAAA;;AAmDA;;AAEA;;AACA;;;;;;;;;AA6ZO,IAAMA,eAAe,GAAGC,kBAAMC,aAAN,CAC7BC,mDAD6B,CAAxB;;;;AAIA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,MAG9BC,QAH8B,QAG9BA,QAH8B;AAAA,MAI9BC,KAJ8B,QAI9BA,KAJ8B;AAAA,SAQ9B,gCAAC,eAAD,CAAiB,QAAjB;AAA0B,IAAA,KAAK,EAAEA,KAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KACGD,QADH,CAR8B;AAAA,CAAzB;;;;AAaA,IAAME,kBAAkB,GAAG,SAArBA,kBAAqB,GAE3B;AACL,MAAMC,YAAY,GAAG,uBACnBR,eADmB,CAArB;;AAIA,MAAIQ,YAAY,KAAKL,mDAAjB,IAA+C,CAAC,2CAApD,EAAyE;AACvE,UAAM,IAAIM,KAAJ,yOAAN;AAGD;;AAED,SAAOD,YAAP;AACD,CAdM;;;;AAqBA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAIjCC,SAJiC,EAKqC;AACtE,MAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CACnCC,KADmC,EAEhC;AACH,QAAMC,eAAe,GAAGP,kBAAkB,EAA1C;AAEA,WAAO,gCAAC,SAAD,gCAAgBM,KAAhB,EAAiCC,eAAjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAP;AACD,GAND;;AAOAF,EAAAA,4BAA4B,CAACG,WAA7B,2BAAiE,oCAAeJ,SAAf,CAAjE;AACA,SAAOC,4BAAP;AACD,CAfM","sourcesContent":["import React, { PropsWithChildren, useContext } from 'react';\n\nimport type { TouchableOpacityProps } from 'react-native';\n\nimport type { MessagePinnedHeaderProps } from 'src/components/Message/MessageSimple/MessagePinnedHeader';\n\nimport type { Attachment, ChannelState, MessageResponse } from 'stream-chat';\n\nimport type { AttachmentProps } from '../../components/Attachment/Attachment';\nimport type { AttachmentActionsProps } from '../../components/Attachment/AttachmentActions';\nimport type { CardProps } from '../../components/Attachment/Card';\nimport type { FileAttachmentProps } from '../../components/Attachment/FileAttachment';\nimport type { FileAttachmentGroupProps } from '../../components/Attachment/FileAttachmentGroup';\nimport type { FileIconProps } from '../../components/Attachment/FileIcon';\nimport type { GalleryProps } from '../../components/Attachment/Gallery';\nimport type { GiphyProps } from '../../components/Attachment/Giphy';\nimport type { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';\nimport type {\n MessageProps,\n MessageTouchableHandlerPayload,\n} from '../../components/Message/Message';\nimport type { MessageAvatarProps } from '../../components/Message/MessageSimple/MessageAvatar';\nimport type { MessageContentProps } from '../../components/Message/MessageSimple/MessageContent';\nimport type { MessageDeletedProps } from '../../components/Message/MessageSimple/MessageDeleted';\nimport type { MessageFooterProps } from '../../components/Message/MessageSimple/MessageFooter';\n\nimport type { MessageRepliesProps } from '../../components/Message/MessageSimple/MessageReplies';\nimport type { MessageRepliesAvatarsProps } from '../../components/Message/MessageSimple/MessageRepliesAvatars';\nimport type { MessageSimpleProps } from '../../components/Message/MessageSimple/MessageSimple';\nimport type { MessageStatusProps } from '../../components/Message/MessageSimple/MessageStatus';\nimport type { MessageTextProps } from '../../components/Message/MessageSimple/MessageTextContainer';\nimport type { ReactionListProps } from '../../components/Message/MessageSimple/ReactionList';\nimport type { MarkdownRules } from '../../components/Message/MessageSimple/utils/renderText';\nimport type { MessageActionsParams } from '../../components/Message/utils/messageActions';\nimport type { DateHeaderProps } from '../../components/MessageList/DateHeader';\nimport type { MessageType } from '../../components/MessageList/hooks/useMessageList';\nimport type { InlineDateSeparatorProps } from '../../components/MessageList/InlineDateSeparator';\nimport type { MessageListProps } from '../../components/MessageList/MessageList';\nimport type { MessageSystemProps } from '../../components/MessageList/MessageSystem';\nimport type { ScrollToBottomButtonProps } from '../../components/MessageList/ScrollToBottomButton';\nimport type { MessageActionType } from '../../components/MessageOverlay/MessageActionListItem';\nimport type { OverlayReactionListProps } from '../../components/MessageOverlay/OverlayReactionList';\nimport type { ReplyProps } from '../../components/Reply/Reply';\nimport type { FlatList } from '../../native';\nimport type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';\nimport type { ReactionData } from '../../utils/utils';\nimport type { Alignment } from '../messageContext/MessageContext';\nimport type { SuggestionCommand } from '../suggestionsContext/SuggestionsContext';\nimport type { DeepPartial } from '../themeContext/ThemeContext';\nimport type { Theme } from '../themeContext/utils/theme';\nimport type { TDateTimeParserInput } from '../translationContext/TranslationContext';\nimport { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';\n\nimport { getDisplayName } from '../utils/getDisplayName';\nimport { isTestEnvironment } from '../utils/isTestEnvironment';\n\nexport type MessageContentType = 'attachments' | 'files' | 'gallery' | 'quoted_reply' | 'text';\n\nexport type MessagesContextValue<\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n> = {\n /**\n * UI component for Attachment.\n * Defaults to: [Attachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Attachment.tsx)\n */\n Attachment: React.ComponentType<AttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display AttachmentActions. e.g., send, shuffle, cancel in case of giphy\n * Defaults to: [AttachmentActions](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/AttachmentActions.tsx)\n */\n AttachmentActions: React.ComponentType<AttachmentActionsProps<StreamChatGenerics>>;\n /**\n * UI component to display generic media type e.g. giphy, url preview etc\n * Defaults to: [Card](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx)\n */\n Card: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * UI component for DateHeader\n * Defaults to: [DateHeader](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/DateHeader.tsx)\n **/\n DateHeader: React.ComponentType<DateHeaderProps>;\n\n /** Should keyboard be dismissed when messaged is touched */\n dismissKeyboardOnMessageTouch: boolean;\n\n enableMessageGroupingByUser: boolean;\n\n /**\n * UI component to display File type attachment.\n * Defaults to: [FileAttachment](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachment.tsx)\n */\n FileAttachment: React.ComponentType<FileAttachmentProps<StreamChatGenerics>>;\n /**\n * UI component to display group of File type attachments or multiple file attachments (in single message).\n * Defaults to: [FileAttachmentGroup](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileAttachmentGroup.tsx)\n */\n FileAttachmentGroup: React.ComponentType<FileAttachmentGroupProps<StreamChatGenerics>>;\n /**\n * UI component for attachment icon for type 'file' attachment.\n * Defaults to: https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/FileIcon.tsx\n */\n FileAttachmentIcon: React.ComponentType<FileIconProps>;\n FlatList: typeof FlatList;\n /**\n * UI component to display image attachments\n * Defaults to: [Gallery](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Gallery.tsx)\n */\n Gallery: React.ComponentType<GalleryProps<StreamChatGenerics>>;\n /**\n * UI component for Giphy\n * Defaults to: [Giphy](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Giphy.tsx)\n */\n Giphy: React.ComponentType<GiphyProps<StreamChatGenerics>>;\n /**\n * The giphy version to render - check the keys of the [Image Object](https://developers.giphy.com/docs/api/schema#image-object) for possible values. Uses 'fixed_height' by default\n * */\n giphyVersion: keyof NonNullable<Attachment['giphy']>;\n /**\n * When true, messageList will be scrolled at first unread message, when opened.\n */\n initialScrollToFirstUnreadMessage: boolean;\n /**\n * UI component for Message Date Separator Component\n * Defaults to: [InlineDateSeparator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageList/InlineDateSeparator.tsx)\n */\n InlineDateSeparator: React.ComponentType<InlineDateSeparatorProps>;\n /**\n * UI component for InlineUnreadIndicator\n * Defaults to: [InlineUnreadIndicator](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/InlineUnreadIndicator.tsx)\n **/\n InlineUnreadIndicator: React.ComponentType;\n Message: React.ComponentType<MessageProps<StreamChatGenerics>>;\n /**\n * UI component for MessageAvatar\n * Defaults to: [MessageAvatar](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageAvatar.tsx)\n **/\n MessageAvatar: React.ComponentType<MessageAvatarProps<StreamChatGenerics>>;\n /**\n * UI component for MessageContent\n * Defaults to: [MessageContent](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageContent.tsx)\n */\n MessageContent: React.ComponentType<MessageContentProps<StreamChatGenerics>>;\n /** Order to render the message content */\n messageContentOrder: MessageContentType[];\n /**\n * UI component for MessageDeleted\n * Defaults to: [MessageDeleted](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageDeleted.tsx)\n */\n MessageDeleted: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;\n /**\n * Custom message footer component\n */\n MessageFooter: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n MessageList: React.ComponentType<MessageListProps<StreamChatGenerics>>;\n /**\n * Custom message pinned component\n */\n MessagePinnedHeader: React.ComponentType<MessagePinnedHeaderProps<StreamChatGenerics>>;\n /**\n * UI component for MessageReplies\n * Defaults to: [MessageReplies](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageReplies.tsx)\n */\n\n MessageReplies: React.ComponentType<MessageRepliesProps<StreamChatGenerics>>;\n /**\n * UI Component for MessageRepliesAvatars\n * Defaults to: [MessageRepliesAvatars](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/MessageSimple/MessageRepliesAvatars.tsx)\n */\n MessageRepliesAvatars: React.ComponentType<MessageRepliesAvatarsProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSimple\n * Defaults to: [MessageSimple](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageSimple.tsx)\n */\n MessageSimple: React.ComponentType<MessageSimpleProps<StreamChatGenerics>>;\n /**\n * UI component for MessageStatus (delivered/read)\n * Defaults to: [MessageStatus](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Message/MessageSimple/MessageStatus.tsx)\n */\n MessageStatus: React.ComponentType<MessageStatusProps<StreamChatGenerics>>;\n /**\n * UI component for MessageSystem\n * Defaults to: [MessageSystem](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-system/)\n */\n MessageSystem: React.ComponentType<MessageSystemProps<StreamChatGenerics>>;\n /**\n * UI component for OverlayReactionList\n */\n OverlayReactionList: React.ComponentType<OverlayReactionListProps<StreamChatGenerics>>;\n /**\n * UI component for ReactionList\n * Defaults to: [ReactionList](https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Reaction/ReactionList.tsx)\n */\n ReactionList: React.ComponentType<ReactionListProps<StreamChatGenerics>>;\n removeMessage: (message: { id: string; parent_id?: string }) => void;\n /**\n * UI component for Reply\n * Defaults to: [Reply](https://getstream.io/chat/docs/sdk/reactnative/ui-components/reply/)\n */\n Reply: React.ComponentType<ReplyProps<StreamChatGenerics>>;\n /**\n * Override the api request for retry message functionality.\n */\n retrySendMessage: (message: MessageResponse<StreamChatGenerics>) => Promise<void>;\n /**\n * UI component for ScrollToBottomButton\n * Defaults to: [ScrollToBottomButton](https://getstream.io/chat/docs/sdk/reactnative/ui-components/scroll-to-bottom-button/)\n */\n ScrollToBottomButton: React.ComponentType<ScrollToBottomButtonProps>;\n setEditingState: (message: MessageType<StreamChatGenerics>) => void;\n setQuotedMessageState: (message: MessageType<StreamChatGenerics>) => void;\n supportedReactions: ReactionData[];\n /**\n * UI component for TypingIndicator\n * Defaults to: [TypingIndicator](https://getstream.io/chat/docs/sdk/reactnative/ui-components/typing-indicator/)\n */\n TypingIndicator: React.ComponentType;\n /**\n * UI component for TypingIndicatorContainer\n * Defaults to: [TypingIndicatorContainer](https://getstream.io/chat/docs/sdk/reactnative/contexts/messages-context/#typingindicatorcontainer)\n */\n TypingIndicatorContainer: React.ComponentType;\n updateMessage: (\n updatedMessage: MessageResponse<StreamChatGenerics>,\n extraState?: {\n commands?: SuggestionCommand<StreamChatGenerics>[];\n messageInput?: string;\n threadMessages?: ChannelState<StreamChatGenerics>['threads'][string];\n },\n ) => void;\n /**\n * Custom UI component to display enriched url preview.\n * Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx\n */\n UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;\n VideoThumbnail: React.ComponentType<VideoThumbnailProps>;\n /**\n * Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.\n * Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props\n *\n * @overrideType Object\n */\n additionalTouchableProps?: Omit<TouchableOpacityProps, 'style'>;\n /**\n * Custom UI component to override default cover (between Header and Footer) of Card component.\n * Accepts the same props as Card component.\n */\n CardCover?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default Footer of Card component.\n * Accepts the same props as Card component.\n */\n CardFooter?: React.ComponentType<CardProps<StreamChatGenerics>>;\n /**\n * Custom UI component to override default header of Card component.\n * Accepts the same props as Card component.\n */\n CardHeader?: React.ComponentType<CardProps<StreamChatGenerics>>;\n\n /**\n * Full override of the delete message button in the Message Actions\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n */\n\n /** Control if the deleted message is visible to both the send and reciever, either of them or none */\n deletedMessagesVisibilityType?: 'always' | 'never' | 'receiver' | 'sender';\n\n disableTypingIndicator?: boolean;\n\n /**\n * Whether messages should be aligned to right or left part of screen.\n * By default, messages will be received messages will be aligned to left and\n * sent messages will be aligned to right.\n */\n forceAlignMessages?: Alignment | boolean;\n /**\n * Optional function to custom format the message date\n */\n formatDate?: (date: TDateTimeParserInput) => string;\n handleBlock?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a copy message action is invoked */\n handleCopy?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a delete message action is invoked */\n handleDelete?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when an edit message action is invoked */\n handleEdit?: (message: MessageType<StreamChatGenerics>) => void;\n /** Handler to access when a flag message action is invoked */\n handleFlag?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a mute user action is invoked */\n handleMute?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a pin/unpin user action is invoked*/\n handlePinMessage?: ((message: MessageType<StreamChatGenerics>) => MessageActionType) | null;\n /** Handler to access when a quoted reply action is invoked */\n handleQuotedReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to process a reaction */\n handleReaction?: (\n message: MessageType<StreamChatGenerics>,\n reactionType: string,\n ) => Promise<void>;\n /** Handler to access when a retry action is invoked */\n handleRetry?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to access when a thread reply action is invoked */\n handleThreadReply?: (message: MessageType<StreamChatGenerics>) => Promise<void>;\n /** Handler to deal with custom memoization logic of Attachment */\n isAttachmentEqual?: (\n prevAttachment: Attachment<StreamChatGenerics>,\n nextAttachment: Attachment<StreamChatGenerics>,\n ) => boolean;\n legacyImageViewerSwipeBehaviour?: boolean;\n /** Object specifying rules defined within simple-markdown https://github.com/Khan/simple-markdown#adding-a-simple-extension */\n markdownRules?: MarkdownRules;\n /**\n * Use this prop to override message actions (which pop-up in message overlay).\n *\n * You can either completely override the default messageActions object.\n *\n * ```\n * <Channel\n * messageActions=[\n * {\n * action: () => { someAction() };\n * title: \"Pin Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * },\n * {\n * action: () => { someAction() };\n * title: \"Delete Message\";\n * icon: PinIcon;\n * titleStyle: {};\n * }\n * ]\n * >\n * </Channel>\n * ```\n *\n * Or you can selectly keep certain action and remove some:\n *\n * e.g. Lets say you only want to keep threadReply and copyMessage actions\n *\n * ```\n * <Channel\n * messageActions={({\n * blockUser,\n * copyMessage,\n * deleteMessage,\n * editMessage,\n * flagMessage,\n * muteUser,\n * quotedReply,\n * retry,\n * threadReply,\n * }) => ([\n * threadReply, copyMessage\n * ])}\n * >\n * </Channel>\n * ```\n *\n * @overrideType Function | Array<Objects>\n */\n messageActions?: (param: MessageActionsParams<StreamChatGenerics>) => MessageActionType[];\n /**\n * Custom message header component\n */\n MessageHeader?: React.ComponentType<MessageFooterProps<StreamChatGenerics>>;\n /** Custom UI component for message text */\n MessageText?: React.ComponentType<MessageTextProps<StreamChatGenerics>>;\n\n /**\n * Theme provided only to messages that are the current users\n */\n myMessageTheme?: DeepPartial<Theme>;\n /**\n * Override default handler for onLongPress on message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onLongPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onLongPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Add onPressIn handler for attachments. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressInMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occured\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressInMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n /**\n * Override onPress handler for message. You have access to payload of that handler as param:\n *\n * ```\n * <Channel\n * onPressMessage={({\n * actionHandlers: {\n * deleteMessage, // () => Promise<void>;\n * editMessage, // () => void;\n * quotedReply, // () => void;\n * resendMessage, // () => Promise<void>;\n * showMessageOverlay, // () => void;\n * toggleBanUser, // () => Promise<void>;\n * toggleMuteUser, // () => Promise<void>;\n * toggleReaction, // (reactionType: string) => Promise<void>;\n * },\n * defaultHandler, // () => void\n * event, // any event object corresponding to touchable feedback\n * emitter, // which component trigged this touchable feedback e.g. card, fileAttachment, gallery, message ... etc\n * message // message object on which longPress occurred\n * }) => {\n * // Your custom action\n * }}\n * />\n * ```\n */\n onPressMessage?: (payload: MessageTouchableHandlerPayload<StreamChatGenerics>) => void;\n\n /**\n * Full override of the reaction function on Message and Message Overlay\n *\n * Please check [cookbook](https://github.com/GetStream/stream-chat-react-native/wiki/Cookbook-v3.0#override-or-intercept-message-actions-edit-delete-reaction-reply-etc) for details.\n * */\n selectReaction?: (\n message: MessageType<StreamChatGenerics>,\n ) => (reactionType: string) => Promise<void>;\n\n targetedMessage?: string;\n};\n\nexport const MessagesContext = React.createContext(\n DEFAULT_BASE_CONTEXT_VALUE as MessagesContextValue,\n);\n\nexport const MessagesProvider = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n children,\n value,\n}: PropsWithChildren<{\n value?: MessagesContextValue<StreamChatGenerics>;\n}>) => (\n <MessagesContext.Provider value={value as unknown as MessagesContextValue}>\n {children}\n </MessagesContext.Provider>\n);\n\nexport const useMessagesContext = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>() => {\n const contextValue = useContext(\n MessagesContext,\n ) as unknown as MessagesContextValue<StreamChatGenerics>;\n\n if (contextValue === DEFAULT_BASE_CONTEXT_VALUE && !isTestEnvironment()) {\n throw new Error(\n `The useMessagesContext hook was called outside of the MessagesContext provider. Make sure you have configured MessageList component correctly - https://getstream.io/chat/docs/sdk/reactnative/basics/hello_stream_chat/#message-list`,\n );\n }\n\n return contextValue;\n};\n\n/**\n * Typescript currently does not support partial inference so if MessagesContext\n * typing is desired while using the HOC withMessagesContext the Props for the\n * wrapped component must be provided as the first generic.\n */\nexport const withMessagesContext = <\n P extends UnknownType,\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n Component: React.ComponentType<P>,\n): React.FC<Omit<P, keyof MessagesContextValue<StreamChatGenerics>>> => {\n const WithMessagesContextComponent = (\n props: Omit<P, keyof MessagesContextValue<StreamChatGenerics>>,\n ) => {\n const messagesContext = useMessagesContext<StreamChatGenerics>();\n\n return <Component {...(props as P)} {...messagesContext} />;\n };\n WithMessagesContextComponent.displayName = `WithMessagesContext${getDisplayName(Component)}`;\n return WithMessagesContextComponent;\n};\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"1 Reply": "תגובה אחת",
|
|
3
|
+
"1 Thread Reply": "תגובה אחת לשרשור",
|
|
4
|
+
"Allow access to your Gallery": "אפשר גישה לגלריה שלך",
|
|
5
|
+
"Also send to channel": "שלח/י הודעה לשיחה",
|
|
6
|
+
"Are you sure you want to permanently delete this message?": "האם את/ה בטוח/ה שאת/ה רוצה למחוק את ההודעה הזו לצמיתות?",
|
|
7
|
+
"Block User": "חסום משתמש",
|
|
8
|
+
"Cancel": "ביטול",
|
|
9
|
+
"Cannot Flag Message": "סימון הודעה לא אפשרי",
|
|
10
|
+
"Copy Message": "העתק/י הודעה",
|
|
11
|
+
"Delete": "מחק",
|
|
12
|
+
"Delete Message": "מחק/י הודעה",
|
|
13
|
+
"Do you want to send a copy of this message to a moderator for further investigation?": "האם את/ה רוצה לשלוח עותק של הודעה זו למנחה להמשך חקירה?",
|
|
14
|
+
"Edit Message": "ערוך הודעה",
|
|
15
|
+
"Editing Message": "הודעה בעריכה",
|
|
16
|
+
"Emoji matching": "התאמת אמוג'י",
|
|
17
|
+
"Empty message...": "הודעה ריקה...",
|
|
18
|
+
"Error loading": "שגיאה ארעה בעת הטעינה",
|
|
19
|
+
"Error loading channel list...": "שגיאה ארעה בטעינת השיחות...",
|
|
20
|
+
"Error loading messages for this channel...": "שגיאה ארעה בטעינת הודעות עבור שיחה זאת...",
|
|
21
|
+
"Error while loading, please reload/refresh": "שגיאה ארעה בזמן הטעינה, אנא טען מחדש/רענן",
|
|
22
|
+
"File type not supported": "סוג הקובץ אינו נתמך",
|
|
23
|
+
"Flag": "סמן",
|
|
24
|
+
"Flag Message": "סמן הודעה",
|
|
25
|
+
"Flag action failed either due to a network issue or the message is already flagged": "פעולת הסימון נכשלה בגלל בעיית רשת או שההודעה כבר סומנה.",
|
|
26
|
+
"Instant Commands": "פעולות מיידיות",
|
|
27
|
+
"Links are disabled": "הקישורים מבוטלים",
|
|
28
|
+
"Loading channels...": "השיחות בטעינה...",
|
|
29
|
+
"Loading messages...": "ההודעות בטעינה..",
|
|
30
|
+
"Loading...": "טוען...",
|
|
31
|
+
"Message Reactions": "תגובות להודעה",
|
|
32
|
+
"Message deleted": "ההודעה נמחקה",
|
|
33
|
+
"Message flagged": "ההודעה סומנה",
|
|
34
|
+
"Mute User": "השתק/י משתמש",
|
|
35
|
+
"Not supported": "לא נתמך",
|
|
36
|
+
"Nothing yet...": "אינפורמציה תתקבל בהמשך...",
|
|
37
|
+
"Ok": "אוקיי",
|
|
38
|
+
"Only visible to you": "גלוי רק לך",
|
|
39
|
+
"Photo": "תמונה",
|
|
40
|
+
"Photos": "תמונות",
|
|
41
|
+
"Pin to Conversation": "הצמד/י לשיחה",
|
|
42
|
+
"Please enable access to your photos and videos so you can share them.": "אפשר/י גישה לתמונות ולסרטונים שלך כדי שתוכל/י לשתף אותם.",
|
|
43
|
+
"Please select a channel first": "אנא בחר/י שיחה תחילה",
|
|
44
|
+
"Reconnecting...": "מתחבר מחדש...",
|
|
45
|
+
"Reply": "השב/י",
|
|
46
|
+
"Reply to Message": "השב/י להודעה",
|
|
47
|
+
"Resend": "שלח/י שוב",
|
|
48
|
+
"Search GIFs": "חפש/י GIFs",
|
|
49
|
+
"Send a message": "שלח/י הודעה",
|
|
50
|
+
"Sending links is not allowed in this conversation": "שליחת קישורים אינה מותרת בשיחה זו",
|
|
51
|
+
"Slow mode ON": "מצב איטי מופעל",
|
|
52
|
+
"The message has been reported to a moderator.": "ההודעה דווחה למנהל",
|
|
53
|
+
"Thread Reply": "הגב/י בשרשור",
|
|
54
|
+
"Unblock User": "בטל/י חסימת משתמש",
|
|
55
|
+
"Unknown User": "משתמש לא ידוע",
|
|
56
|
+
"Unmute User": "בטל/י השתקת משתמש",
|
|
57
|
+
"Unpin from Conversation": "בטל/י הצמדה לשיחה",
|
|
58
|
+
"Unread Messages": "הודעות שטרם נקרו",
|
|
59
|
+
"You": "את/ה",
|
|
60
|
+
"You can't send messages in this channel": "את/ב לא יכול/ה לשלוח הודעות בשיחה זו",
|
|
61
|
+
"{{ firstUser }} and {{ nonSelfUserLength }} more are typing": "{{ firstUser }} ו-{{ nonSelfUserLength }} משתמש/ים אחר/ים מקלידים",
|
|
62
|
+
"{{ index }} of {{ photoLength }}": "{{ index }} מתוך {{ photoLength }}",
|
|
63
|
+
"{{ replyCount }} Replies": "{{ replyCount }} תגובות",
|
|
64
|
+
"{{ replyCount }} Thread Replies": "{{ replyCount }} תגובות שרשור",
|
|
65
|
+
"{{ user }} is typing": "{{ user }} מקליד/ה",
|
|
66
|
+
"🏙 Attachment...": "🏙 קובץ מצורף..."
|
|
67
|
+
}
|
package/lib/module/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var _exportNames = {
|
|
|
13
13
|
nlTranslations: true,
|
|
14
14
|
ruTranslations: true,
|
|
15
15
|
trTranslations: true,
|
|
16
|
+
heTranslations: true,
|
|
16
17
|
version: true
|
|
17
18
|
};
|
|
18
19
|
Object.defineProperty(exports, "NetInfo", {
|
|
@@ -33,6 +34,12 @@ Object.defineProperty(exports, "frTranslations", {
|
|
|
33
34
|
return _fr["default"];
|
|
34
35
|
}
|
|
35
36
|
});
|
|
37
|
+
Object.defineProperty(exports, "heTranslations", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function get() {
|
|
40
|
+
return _he["default"];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
36
43
|
Object.defineProperty(exports, "hiTranslations", {
|
|
37
44
|
enumerable: true,
|
|
38
45
|
get: function get() {
|
|
@@ -204,5 +211,7 @@ var _ru = _interopRequireDefault(require("./i18n/ru.json"));
|
|
|
204
211
|
|
|
205
212
|
var _tr = _interopRequireDefault(require("./i18n/tr.json"));
|
|
206
213
|
|
|
214
|
+
var _he = _interopRequireDefault(require("./i18n/he.json"));
|
|
215
|
+
|
|
207
216
|
var _version = require("./version.json");
|
|
208
217
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA","sourcesContent":["export * from './components';\nexport * from './hooks';\nexport { registerNativeHandlers, NetInfo } from './native';\nexport * from './contexts';\nexport * from './emoji-data/compiled';\n\nexport * from './icons';\n\nexport * from './types/types';\n\nexport * from './utils/Streami18n';\nexport * from './utils/utils';\n\nexport { default as enTranslations } from './i18n/en.json';\nexport { default as frTranslations } from './i18n/fr.json';\nexport { default as hiTranslations } from './i18n/hi.json';\nexport { default as itTranslations } from './i18n/it.json';\nexport { default as nlTranslations } from './i18n/nl.json';\nexport { default as ruTranslations } from './i18n/ru.json';\nexport { default as trTranslations } from './i18n/tr.json';\nexport { default as heTranslations } from './i18n/he.json';\n\nexport { version } from './version.json';\n"]}
|
|
@@ -35,6 +35,8 @@ var _en2 = _interopRequireDefault(require("../i18n/en.json"));
|
|
|
35
35
|
|
|
36
36
|
var _fr2 = _interopRequireDefault(require("../i18n/fr.json"));
|
|
37
37
|
|
|
38
|
+
var _he2 = _interopRequireDefault(require("../i18n/he.json"));
|
|
39
|
+
|
|
38
40
|
var _hi2 = _interopRequireDefault(require("../i18n/hi.json"));
|
|
39
41
|
|
|
40
42
|
var _it2 = _interopRequireDefault(require("../i18n/it.json"));
|
|
@@ -65,6 +67,8 @@ require("dayjs/locale/ru");
|
|
|
65
67
|
|
|
66
68
|
require("dayjs/locale/tr");
|
|
67
69
|
|
|
70
|
+
require("dayjs/locale/he");
|
|
71
|
+
|
|
68
72
|
require("dayjs/locale/en");
|
|
69
73
|
|
|
70
74
|
var defaultNS = 'translation';
|
|
@@ -210,6 +214,7 @@ var Streami18n = function () {
|
|
|
210
214
|
this.translations = {
|
|
211
215
|
en: (0, _defineProperty2["default"])({}, defaultNS, _en2["default"]),
|
|
212
216
|
fr: (0, _defineProperty2["default"])({}, defaultNS, _fr2["default"]),
|
|
217
|
+
he: (0, _defineProperty2["default"])({}, defaultNS, _he2["default"]),
|
|
213
218
|
hi: (0, _defineProperty2["default"])({}, defaultNS, _hi2["default"]),
|
|
214
219
|
it: (0, _defineProperty2["default"])({}, defaultNS, _it2["default"]),
|
|
215
220
|
ja: (0, _defineProperty2["default"])({}, defaultNS, _ja2["default"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Streami18n.ts"],"names":["defaultNS","defaultLng","Dayjs","extend","updateLocale","format","L","LL","LLL","LLLL","LT","LTS","calendar","lastDay","lastWeek","nextDay","nextWeek","sameDay","sameElse","meridiem","hour","meridiemHour","meridiemParse","en_locale","formats","months","relativeTime","weekdays","isDayJs","dateTimeParser","undefined","defaultStreami18nOptions","DateTimeParser","dayjsLocaleConfigForLanguage","debug","disableDateTimeTranslations","language","logger","msg","console","warn","Streami18n","options","i18nextConfig","i18nInstance","i18n","createInstance","setLanguageCallback","initialized","t","key","translations","en","enTranslations","fr","frTranslations","hi","hiTranslations","it","itTranslations","ja","jaTranslations","ko","koTranslations","nl","nlTranslations","ru","ruTranslations","tr","trTranslations","dayjsLocales","localeExists","isCustomDateTimeParser","Object","keys","Ls","indexOf","validateCurrentLanguage","availableLanguages","currentLanguage","getAvailableLanguages","geti18Instance","getTranslations","finalOptions","LocalizedFormat","localeData","error","Error","JSON","stringify","translationsForLanguage","fallbackLng","interpolation","escapeValue","keySeparator","lng","nsSeparator","parseMissingKeyHandler","addOrUpdateLocale","tDateTimeParser","timestamp","locale","init","resources","translation","customDayjsLocale","addResources","config","name","changeLanguage","callback"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAjBA,IAAMA,SAAS,GAAG,aAAlB;AACA,IAAMC,UAAU,GAAG,IAAnB;;AAoBAC,kBAAMC,MAAN,CAAaC,wBAAb;;AAEAF,kBAAME,YAAN,CAAmB,IAAnB,EAAyB;AACvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,CAAC,EAAE,YADG;AAENC,IAAAA,EAAE,EAAE,aAFE;AAGNC,IAAAA,GAAG,EAAE,mBAHC;AAINC,IAAAA,IAAI,EAAE,yBAJA;AAKNC,IAAAA,EAAE,EAAE,QALE;AAMNC,IAAAA,GAAG,EAAE;AANC;AADe,CAAzB;;AAWAT,kBAAME,YAAN,CAAmB,IAAnB,EAAyB;AACvBQ,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,kBADD;AAERC,IAAAA,QAAQ,EAAE,0BAFF;AAGRC,IAAAA,OAAO,EAAE,gBAHD;AAIRC,IAAAA,QAAQ,EAAE,cAJF;AAKRC,IAAAA,OAAO,EAAE,iBALD;AAMRC,IAAAA,QAAQ,EAA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,iBAAL,CAAuB,KAAKnB,eAA5B,EAA6C,KAAKT,YAAL,CAAkB,KAAKS,eAAvB,CAA7C;AACD;;AACD,qBAAKhC,mBAAL,CAAyBE,EAAzB;AAVJ,kDAYWA,EAZX;;AAAA;AAAA;AAAA;AAcI,qBAAKZ,MAAL,8BAAuCmD,IAAI,CAACC,SAAL,cAAvC;AAdJ,kDAeW,KAAKxC,CAfhB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAmBA,qCAA4B6D,QAA5B,EAA8D;AAC5D,WAAK/D,mBAAL,GAA2B+D,QAA3B;AACD","sourcesContent":["import Dayjs from 'dayjs';\nimport calendar from 'dayjs/plugin/calendar';\nimport localeData from 'dayjs/plugin/localeData';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport updateLocale from 'dayjs/plugin/updateLocale';\nimport i18n, { FallbackLng, TFunction } from 'i18next';\n\nimport type moment from 'moment';\n\nimport type { TDateTimeParser } from '../contexts/translationContext/TranslationContext';\nimport enTranslations from '../i18n/en.json';\nimport frTranslations from '../i18n/fr.json';\nimport hiTranslations from '../i18n/hi.json';\nimport itTranslations from '../i18n/it.json';\nimport jaTranslations from '../i18n/ja.json';\nimport koTranslations from '../i18n/ko.json';\nimport nlTranslations from '../i18n/nl.json';\nimport ruTranslations from '../i18n/ru.json';\nimport trTranslations from '../i18n/tr.json';\n\nconst defaultNS = 'translation';\nconst defaultLng = 'en';\n\nimport 'dayjs/locale/fr';\nimport 'dayjs/locale/hi';\nimport 'dayjs/locale/it';\nimport 'dayjs/locale/ja';\nimport 'dayjs/locale/ko';\nimport 'dayjs/locale/nl';\nimport 'dayjs/locale/ru';\nimport 'dayjs/locale/tr';\n\n/**\n * These locale imports also set these locales globally.\n * So as a last step we import the english locale to make\n * sure we don't mess up languages in other places in the app.\n */\nimport 'dayjs/locale/en';\n\nimport type { DefaultStreamChatGenerics } from '../types/types';\n\nDayjs.extend(updateLocale);\n\nDayjs.updateLocale('en', {\n format: {\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n LT: 'hh:mmA',\n LTS: 'HH:mm:ss',\n },\n});\n\nDayjs.updateLocale('nl', {\n calendar: {\n lastDay: '[gisteren om] LT',\n lastWeek: '[afgelopen] dddd [om] LT',\n nextDay: '[morgen om] LT',\n nextWeek: 'dddd [om] LT',\n sameDay: '[vandaag om] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('it', {\n calendar: {\n lastDay: '[Ieri alle] LT',\n lastWeek: '[lo scorso] dddd [alle] LT',\n nextDay: '[Domani alle] LT',\n nextWeek: 'dddd [alle] LT',\n sameDay: '[Oggi alle] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('hi', {\n calendar: {\n lastDay: '[कल] LT',\n lastWeek: '[पिछले] dddd, LT',\n nextDay: '[कल] LT',\n nextWeek: 'dddd, LT',\n sameDay: '[आज] LT',\n sameElse: 'L',\n },\n\n /**\n * Hindi notation for meridiems are quite fuzzy in practice. While there exists\n * a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.\n */\n meridiem(hour: number) {\n if (hour < 4) return 'रात';\n if (hour < 10) return 'सुबह';\n if (hour < 17) return 'दोपहर';\n if (hour < 20) return 'शाम';\n return 'रात';\n },\n\n meridiemHour(hour: number, meridiem: string) {\n if (hour === 12) {\n hour = 0;\n }\n if (meridiem === 'रात') return hour < 4 ? hour : hour + 12;\n if (meridiem === 'सुबह') return hour;\n if (meridiem === 'दोपहर') return hour >= 10 ? hour : hour + 12;\n if (meridiem === 'शाम') return hour + 12;\n return hour;\n },\n\n meridiemParse: /रात|सुबह|दोपहर|शाम/,\n});\n\nDayjs.updateLocale('fr', {\n calendar: {\n lastDay: '[Hier à] LT',\n lastWeek: 'dddd [dernier à] LT',\n nextDay: '[Demain à] LT',\n nextWeek: 'dddd [à] LT',\n sameDay: '[Aujourd’hui à] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('tr', {\n calendar: {\n lastDay: '[dün] LT',\n lastWeek: '[geçen] dddd [saat] LT',\n nextDay: '[yarın saat] LT',\n nextWeek: '[gelecek] dddd [saat] LT',\n sameDay: '[bugün saat] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('ru', {\n calendar: {\n lastDay: '[Вчера, в] LT',\n nextDay: '[Завтра, в] LT',\n sameDay: '[Сегодня, в] LT',\n },\n});\n\nconst en_locale = {\n formats: {},\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n relativeTime: {},\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n};\n\n// Type guards to check DayJs\nconst isDayJs = (dateTimeParser: typeof Dayjs | typeof moment): dateTimeParser is typeof Dayjs =>\n (dateTimeParser as typeof Dayjs).extend !== undefined;\n\ntype Options = {\n DateTimeParser?: typeof Dayjs | typeof moment;\n dayjsLocaleConfigForLanguage?: Partial<ILocale>;\n debug?: boolean;\n disableDateTimeTranslations?: boolean;\n language?: string;\n logger?: (msg?: string) => void;\n translationsForLanguage?: Partial<typeof enTranslations>;\n};\n\ntype I18NextConfig = {\n debug: boolean;\n fallbackLng: false | FallbackLng;\n interpolation: { escapeValue: boolean };\n keySeparator: false | string;\n lng: string;\n nsSeparator: false | string;\n parseMissingKeyHandler: (key: string) => string;\n};\n\n/**\n * Wrapper around [i18next](https://www.i18next.com/) class for Stream related translations.\n * Instance of this class should be provided to Chat component to handle translations.\n * Stream provides following list of in-built translations:\n * 1. English (en)\n * 2. Dutch (nl)\n * 3. Russian (ru)\n * 4. Turkish (tr)\n * 5. French (fr)\n * 6. Italian (it)\n * 7. Hindi (hi)\n *\n * Simplest way to start using chat components in one of the in-built languages would be following:\n *\n * ```\n * const i18n = new Streami18n({ language 'nl' });\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * If you would like to override certain keys in in-built translation.\n * UI will be automatically updated in this case.\n *\n * ```\n * const i18n = new Streami18n({\n * language: 'nl',\n * translationsForLanguage: {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * }\n * });\n *\n * If you would like to register additional languages, use registerTranslation. You can add as many languages as you want:\n *\n * i18n.registerTranslation('zh', {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * });\n *\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * You can use the same function to add whole new language as well.\n *\n * ```\n * const i18n = new Streami18n();\n *\n * i18n.registerTranslation('mr', {\n * 'Nothing yet...': 'काहीही नाही ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',\n * });\n *\n * // Make sure to call setLanguage to reflect new language in UI.\n * i18n.setLanguage('it');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * ## Datetime translations\n *\n * Stream react chat components uses [dayjs](https://day.js.org/en/) internally by default to format datetime stamp.\n * e.g., in ChannelPreview, MessageContent components.\n * Dayjs has locale support as well - https://day.js.org/docs/en/i18n/i18n\n * Dayjs is a lightweight alternative to Momentjs with the same modern API.\n *\n * Dayjs provides locale config for plenty of languages, you can check the whole list of locale configs at following url\n * https://github.com/iamkun/dayjs/tree/dev/src/locale\n *\n * You can either provide the dayjs locale config while registering\n * language with Streami18n (either via constructor or registerTranslation()) or you can provide your own Dayjs or Moment instance\n * to Streami18n constructor, which will be then used internally (using the language locale) in components.\n *\n * 1. Via language registration\n *\n * e.g.,\n * ```\n * const i18n = new Streami18n({\n * language: 'nl',\n * dayjsLocaleConfigForLanguage: {\n * months: [...],\n * monthsShort: [...],\n * calendar: {\n * sameDay: ...'\n * }\n * }\n * });\n * ```\n *\n * Similarly, you can add locale config for moment while registering translation via `registerTranslation` function.\n *\n * e.g.,\n * ```\n * const i18n = new Streami18n();\n *\n * i18n.registerTranslation(\n * 'mr',\n * {\n * 'Nothing yet...': 'काहीही नाही ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',\n * },\n * {\n * months: [...],\n * monthsShort: [...],\n * calendar: {\n * sameDay: ...'\n * }\n * }\n * );\n *```\n * 2. Provide your own Moment object\n *\n * ```js\n * import 'moment/locale/nl';\n * import 'moment/locale/it';\n * // or if you want to include all locales\n * import 'moment/min/locales';\n *\n * import Moment from moment\n *\n * const i18n = new Streami18n({\n * language: 'nl',\n * DateTimeParser: Moment\n * })\n * ```\n *\n * 3. Provide your own Dayjs object\n *\n * ```js\n * import Dayjs from 'dayjs'\n *\n * import 'dayjs/locale/nl';\n * import 'dayjs/locale/it';\n * // or if you want to include all locales\n * import 'dayjs/min/locales';\n *\n * const i18n = new Streami18n({\n * language: 'nl',\n * DateTimeParser: Dayjs\n * })\n * ```\n * If you would like to stick with english language for date-times in Stream components, you can set `disableDateTimeTranslations` to true.\n *\n */\nconst defaultStreami18nOptions = {\n DateTimeParser: Dayjs,\n dayjsLocaleConfigForLanguage: null,\n debug: false,\n disableDateTimeTranslations: false,\n language: 'en',\n logger: (msg?: string) => console.warn(msg),\n};\n\nexport class Streami18n {\n i18nInstance = i18n.createInstance();\n Dayjs = null;\n setLanguageCallback: (t: TFunction) => void = () => null;\n initialized = false;\n\n t: TFunction = (key: string) => key;\n tDateTimeParser: TDateTimeParser;\n\n translations: {\n [key: string]: {\n [key: string]: Partial<typeof enTranslations> | DefaultStreamChatGenerics;\n };\n } = {\n en: { [defaultNS]: enTranslations },\n fr: { [defaultNS]: frTranslations },\n hi: { [defaultNS]: hiTranslations },\n it: { [defaultNS]: itTranslations },\n ja: { [defaultNS]: jaTranslations },\n ko: { [defaultNS]: koTranslations },\n nl: { [defaultNS]: nlTranslations },\n ru: { [defaultNS]: ruTranslations },\n tr: { [defaultNS]: trTranslations },\n };\n\n /**\n * dayjs.defineLanguage('nl') also changes the global locale. We don't want to do that\n * when a user calls the registerTranslation() function. So instead we will store the\n * locale configs given to the registerTranslation() function in `dayjsLocales` object,\n * and register the required locale with moment when setLanguage is called.\n */\n dayjsLocales: { [key: string]: Partial<ILocale> } = {};\n\n /**\n * Initialize properties used in constructor\n */\n logger: (msg?: string) => void;\n currentLanguage: string;\n DateTimeParser: typeof Dayjs | typeof moment;\n isCustomDateTimeParser: boolean;\n i18nextConfig: I18NextConfig;\n\n /**\n * Constructor accepts following options:\n * - language (String) default: 'en'\n * Language code e.g., en, tr\n *\n * - translationsForLanguage (object)\n * Translations object. Please check src/i18n/en.json for example.\n *\n * - disableDateTimeTranslations (boolean) default: false\n * Disable translations for date-times\n *\n * - debug (boolean) default: false\n * Enable debug mode in internal i18n class\n *\n * - logger (function) default: () => {}\n * Logger function to log warnings/errors from this class\n *\n * - dayjsLocaleConfigForLanguage (object) default: 'enConfig'\n * [Config object](https://momentjs.com/docs/#/i18n/changing-locale/) for internal moment object,\n * corresponding to language (param)\n *\n * - DateTimeParser (function) Moment or Dayjs instance/function.\n * Make sure to load all the required locales in this Moment or Dayjs instance that you will be provide to Streami18n\n *\n * @param {*} options\n */\n constructor(options: Options = {}, i18nextConfig: Partial<I18NextConfig> = {}) {\n const finalOptions = {\n ...defaultStreami18nOptions,\n ...options,\n };\n\n // Prepare the i18next configuration.\n this.logger = finalOptions.logger;\n\n this.currentLanguage = finalOptions.language;\n this.DateTimeParser = finalOptions.DateTimeParser;\n\n try {\n /**\n * This is a shallow check to see if the given parser is an instance of Dayjs.\n * For some reason Dayjs.isDayjs(this.DateTimeParser()) doesn't work.\n */\n if (this.DateTimeParser && isDayJs(this.DateTimeParser)) {\n this.DateTimeParser.extend(LocalizedFormat);\n this.DateTimeParser.extend(calendar);\n this.DateTimeParser.extend(localeData);\n this.DateTimeParser.extend(relativeTime);\n }\n } catch (error) {\n throw new Error(\n `Streami18n: Looks like you wanted to provide a Dayjs instance but something went wrong while adding plugins ${JSON.stringify(\n error,\n )}`,\n );\n }\n\n this.isCustomDateTimeParser = !!options.DateTimeParser;\n const translationsForLanguage = finalOptions.translationsForLanguage;\n\n if (translationsForLanguage) {\n this.translations[this.currentLanguage] = {\n [defaultNS]:\n this.translations[this.currentLanguage] &&\n this.translations[this.currentLanguage][defaultNS]\n ? {\n ...this.translations[this.currentLanguage][defaultNS],\n ...translationsForLanguage,\n }\n : translationsForLanguage,\n };\n }\n\n // If translations don't exist for given language, then set it as empty object.\n if (!this.translations[this.currentLanguage]) {\n this.translations[this.currentLanguage] = {\n [defaultNS]: {},\n };\n }\n\n this.i18nextConfig = {\n debug: finalOptions.debug,\n fallbackLng: false,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: this.currentLanguage,\n nsSeparator: false,\n\n parseMissingKeyHandler: (key: string) => {\n this.logger(`Streami18n: Missing translation for key: ${key}`);\n\n return key;\n },\n ...i18nextConfig,\n };\n\n this.validateCurrentLanguage();\n\n const dayjsLocaleConfigForLanguage = finalOptions.dayjsLocaleConfigForLanguage;\n\n if (dayjsLocaleConfigForLanguage) {\n this.addOrUpdateLocale(this.currentLanguage, {\n ...dayjsLocaleConfigForLanguage,\n });\n } else if (!this.localeExists(this.currentLanguage)) {\n this.logger(\n `Streami18n: Streami18n(...) - Locale config for ${this.currentLanguage} does not exist in momentjs.` +\n `Please import the locale file using \"import 'moment/locale/${this.currentLanguage}';\" in your app or ` +\n `register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`,\n );\n }\n\n this.tDateTimeParser = (timestamp) => {\n if (finalOptions.disableDateTimeTranslations || !this.localeExists(this.currentLanguage)) {\n /**\n * TS needs to know which is being called to accept the chain call\n */\n if (isDayJs(this.DateTimeParser)) {\n return this.DateTimeParser(timestamp).locale(defaultLng);\n }\n return this.DateTimeParser(timestamp).locale(defaultLng);\n }\n if (isDayJs(this.DateTimeParser)) {\n return this.DateTimeParser(timestamp).locale(this.currentLanguage);\n }\n return this.DateTimeParser(timestamp).locale(this.currentLanguage);\n };\n }\n\n /**\n * Initializes the i18next instance with configuration (which enables natural language as default keys)\n */\n async init() {\n this.validateCurrentLanguage();\n\n try {\n this.t = await this.i18nInstance.init({\n ...this.i18nextConfig,\n lng: this.currentLanguage,\n resources: this.translations,\n });\n this.initialized = true;\n } catch (error) {\n this.logger(`Something went wrong with init: ${JSON.stringify(error)}`);\n }\n\n return {\n t: this.t,\n tDateTimeParser: this.tDateTimeParser,\n };\n }\n\n localeExists = (language: string) => {\n if (this.isCustomDateTimeParser) return true;\n\n return Object.keys(Dayjs.Ls).indexOf(language) > -1;\n };\n\n validateCurrentLanguage = () => {\n const availableLanguages = Object.keys(this.translations);\n if (availableLanguages.indexOf(this.currentLanguage) === -1) {\n this.logger(\n `Streami18n: '${this.currentLanguage}' language is not registered.` +\n ` Please make sure to call streami18n.registerTranslation('${this.currentLanguage}', {...}) or ` +\n `use one the built-in supported languages - ${this.getAvailableLanguages()}`,\n );\n\n this.currentLanguage = defaultLng;\n }\n };\n\n /** Returns an instance of i18next used within this class instance */\n geti18Instance = () => this.i18nInstance;\n\n /** Returns list of available languages. */\n getAvailableLanguages = () => Object.keys(this.translations);\n\n /** Returns all the translation dictionary for all inbuilt-languages */\n getTranslations = () => this.translations;\n\n /**\n * Returns current version translator function.\n */\n async getTranslators() {\n if (!this.initialized) {\n if (this.dayjsLocales[this.currentLanguage]) {\n this.addOrUpdateLocale(this.currentLanguage, this.dayjsLocales[this.currentLanguage]);\n }\n return await this.init();\n } else {\n return {\n t: this.t,\n tDateTimeParser: this.tDateTimeParser,\n };\n }\n }\n\n /**\n * Register translation\n */\n registerTranslation(\n language: string,\n translation: Partial<typeof enTranslations> | DefaultStreamChatGenerics,\n customDayjsLocale?: Partial<ILocale>,\n ) {\n if (!translation) {\n this.logger(\n `Streami18n: registerTranslation(language, translation, customDayjsLocale) called without translation`,\n );\n return;\n }\n\n if (!this.translations[language]) {\n this.translations[language] = { [defaultNS]: translation };\n } else {\n this.translations[language][defaultNS] = translation;\n }\n\n if (customDayjsLocale) {\n this.dayjsLocales[language] = { ...customDayjsLocale };\n } else if (!this.localeExists(language)) {\n this.logger(\n `Streami18n: registerTranslation(language, translation, customDayjsLocale) - ` +\n `Locale config for ${language} does not exist in Dayjs.` +\n `Please import the locale file using \"import 'dayjs/locale/${language}';\" in your app or ` +\n `register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`,\n );\n }\n\n if (this.initialized) {\n this.i18nInstance.addResources(language, defaultNS, translation);\n }\n }\n\n addOrUpdateLocale(key: string, config: Partial<ILocale>) {\n if (this.localeExists(key)) {\n Dayjs.updateLocale(key, { ...config });\n } else {\n // Merging the custom locale config with en config, so missing keys can default to english.\n Dayjs.locale({ name: key, ...en_locale, ...config }, undefined, true);\n }\n }\n\n /**\n * Changes the language.\n */\n async setLanguage(language: string) {\n this.currentLanguage = language;\n\n if (!this.initialized) return;\n\n try {\n const t = await this.i18nInstance.changeLanguage(language);\n if (this.dayjsLocales[language]) {\n this.addOrUpdateLocale(this.currentLanguage, this.dayjsLocales[this.currentLanguage]);\n }\n this.setLanguageCallback(t);\n\n return t;\n } catch (error) {\n this.logger(`Failed to set language: ${JSON.stringify(error)}`);\n return this.t;\n }\n }\n\n registerSetLanguageCallback(callback: (t: TFunction) => void) {\n this.setLanguageCallback = callback;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["Streami18n.ts"],"names":["defaultNS","defaultLng","Dayjs","extend","updateLocale","format","L","LL","LLL","LLLL","LT","LTS","calendar","lastDay","lastWeek","nextDay","nextWeek","sameDay","sameElse","meridiem","hour","meridiemHour","meridiemParse","en_locale","formats","months","relativeTime","weekdays","isDayJs","dateTimeParser","undefined","defaultStreami18nOptions","DateTimeParser","dayjsLocaleConfigForLanguage","debug","disableDateTimeTranslations","language","logger","msg","console","warn","Streami18n","options","i18nextConfig","i18nInstance","i18n","createInstance","setLanguageCallback","initialized","t","key","translations","en","enTranslations","fr","frTranslations","he","heTranslations","hi","hiTranslations","it","itTranslations","ja","jaTranslations","ko","koTranslations","nl","nlTranslations","ru","ruTranslations","tr","trTranslations","dayjsLocales","localeExists","isCustomDateTimeParser","Object","keys","Ls","indexOf","validateCurrentLanguage","availableLanguages","currentLanguage","getAvailableLanguages","geti18Instance","getTranslations","finalOptions","LocalizedFormat","localeData","error","Error","JSON","stringify","translationsForLanguage","fallbackLng","interpolation","escapeValue","keySeparator","lng","nsSeparator","parseMissingKeyHandler","addOrUpdateLocale","tDateTimeParser","timestamp","locale","init","resources","translation","customDayjsLocale","addResources","config","name","changeLanguage","callback"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAIA,IAAMA,SAAS,GAAG,aAAlB;AACA,IAAMC,UAAU,GAAG,IAAnB;;AAEAC,kBAAMC,MAAN,CAAaC,wBAAb;;AAEAF,kBAAME,YAAN,CAAmB,IAAnB,EAAyB;AACvBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,CAAC,EAAE,YADG;AAENC,IAAAA,EAAE,EAAE,aAFE;AAGNC,IAAAA,GAAG,EAAE,mBAHC;AAINC,IAAAA,IAAI,EAAE,yBAJA;AAKNC,IAAAA,EAAE,EAAE,QALE;AAMNC,IAAAA,GAAG,EAAE;AANC;AADe,CAAzB;;AAWAT,kBAAME,YAAN,CAAmB,IAAnB,EAAyB;AACvBQ,EAAAA,QAAQ,EAAE;AACRC,IAAAA,OAAO,EAAE,kBADD;AAERC,IAAAA,QAAQ,EAAE,0BAFF;AAGR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;AAAA,uBAMoB,KAAKJ,YAAL,CAAkBmE,cAAlB,CAAiC3E,QAAjC,CANpB;;AAAA;AAMUa,gBAAAA,EANV;;AAOI,oBAAI,KAAKuB,YAAL,CAAkBpC,QAAlB,CAAJ,EAAiC;AAC/B,uBAAKgE,iBAAL,CAAuB,KAAKnB,eAA5B,EAA6C,KAAKT,YAAL,CAAkB,KAAKS,eAAvB,CAA7C;AACD;;AACD,qBAAKlC,mBAAL,CAAyBE,EAAzB;AAVJ,kDAYWA,EAZX;;AAAA;AAAA;AAAA;AAcI,qBAAKZ,MAAL,8BAAuCqD,IAAI,CAACC,SAAL,cAAvC;AAdJ,kDAeW,KAAK1C,CAfhB;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAmBA,qCAA4B+D,QAA5B,EAA8D;AAC5D,WAAKjE,mBAAL,GAA2BiE,QAA3B;AACD","sourcesContent":["import Dayjs from 'dayjs';\nimport calendar from 'dayjs/plugin/calendar';\nimport localeData from 'dayjs/plugin/localeData';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport updateLocale from 'dayjs/plugin/updateLocale';\nimport i18n, { FallbackLng, TFunction } from 'i18next';\n\nimport type moment from 'moment';\n\nimport type { TDateTimeParser } from '../contexts/translationContext/TranslationContext';\nimport enTranslations from '../i18n/en.json';\nimport frTranslations from '../i18n/fr.json';\nimport heTranslations from '../i18n/he.json';\nimport hiTranslations from '../i18n/hi.json';\nimport itTranslations from '../i18n/it.json';\nimport jaTranslations from '../i18n/ja.json';\nimport koTranslations from '../i18n/ko.json';\nimport nlTranslations from '../i18n/nl.json';\nimport ruTranslations from '../i18n/ru.json';\nimport trTranslations from '../i18n/tr.json';\n\nimport 'dayjs/locale/fr';\nimport 'dayjs/locale/hi';\nimport 'dayjs/locale/it';\nimport 'dayjs/locale/ja';\nimport 'dayjs/locale/ko';\nimport 'dayjs/locale/nl';\nimport 'dayjs/locale/ru';\nimport 'dayjs/locale/tr';\nimport 'dayjs/locale/he';\n\n/**\n * These locale imports also set these locales globally.\n * So as a last step we import the english locale to make\n * sure we don't mess up languages in other places in the app.\n */\nimport 'dayjs/locale/en';\n\nimport type { DefaultStreamChatGenerics } from '../types/types';\n\nconst defaultNS = 'translation';\nconst defaultLng = 'en';\n\nDayjs.extend(updateLocale);\n\nDayjs.updateLocale('en', {\n format: {\n L: 'DD/MM/YYYY',\n LL: 'D MMMM YYYY',\n LLL: 'D MMMM YYYY HH:mm',\n LLLL: 'dddd, D MMMM YYYY HH:mm',\n LT: 'hh:mmA',\n LTS: 'HH:mm:ss',\n },\n});\n\nDayjs.updateLocale('nl', {\n calendar: {\n lastDay: '[gisteren om] LT',\n lastWeek: '[afgelopen] dddd [om] LT',\n nextDay: '[morgen om] LT',\n nextWeek: 'dddd [om] LT',\n sameDay: '[vandaag om] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('it', {\n calendar: {\n lastDay: '[Ieri alle] LT',\n lastWeek: '[lo scorso] dddd [alle] LT',\n nextDay: '[Domani alle] LT',\n nextWeek: 'dddd [alle] LT',\n sameDay: '[Oggi alle] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('hi', {\n calendar: {\n lastDay: '[कल] LT',\n lastWeek: '[पिछले] dddd, LT',\n nextDay: '[कल] LT',\n nextWeek: 'dddd, LT',\n sameDay: '[आज] LT',\n sameElse: 'L',\n },\n\n /**\n * Hindi notation for meridiems are quite fuzzy in practice. While there exists\n * a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.\n */\n meridiem(hour: number) {\n if (hour < 4) return 'रात';\n if (hour < 10) return 'सुबह';\n if (hour < 17) return 'दोपहर';\n if (hour < 20) return 'शाम';\n return 'रात';\n },\n\n meridiemHour(hour: number, meridiem: string) {\n if (hour === 12) {\n hour = 0;\n }\n if (meridiem === 'रात') return hour < 4 ? hour : hour + 12;\n if (meridiem === 'सुबह') return hour;\n if (meridiem === 'दोपहर') return hour >= 10 ? hour : hour + 12;\n if (meridiem === 'शाम') return hour + 12;\n return hour;\n },\n\n meridiemParse: /रात|सुबह|दोपहर|शाम/,\n});\n\nDayjs.updateLocale('fr', {\n calendar: {\n lastDay: '[Hier à] LT',\n lastWeek: 'dddd [dernier à] LT',\n nextDay: '[Demain à] LT',\n nextWeek: 'dddd [à] LT',\n sameDay: '[Aujourd’hui à] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('tr', {\n calendar: {\n lastDay: '[dün] LT',\n lastWeek: '[geçen] dddd [saat] LT',\n nextDay: '[yarın saat] LT',\n nextWeek: '[gelecek] dddd [saat] LT',\n sameDay: '[bugün saat] LT',\n sameElse: 'L',\n },\n});\n\nDayjs.updateLocale('ru', {\n calendar: {\n lastDay: '[Вчера, в] LT',\n nextDay: '[Завтра, в] LT',\n sameDay: '[Сегодня, в] LT',\n },\n});\n\nconst en_locale = {\n formats: {},\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n relativeTime: {},\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n};\n\n// Type guards to check DayJs\nconst isDayJs = (dateTimeParser: typeof Dayjs | typeof moment): dateTimeParser is typeof Dayjs =>\n (dateTimeParser as typeof Dayjs).extend !== undefined;\n\ntype Options = {\n DateTimeParser?: typeof Dayjs | typeof moment;\n dayjsLocaleConfigForLanguage?: Partial<ILocale>;\n debug?: boolean;\n disableDateTimeTranslations?: boolean;\n language?: string;\n logger?: (msg?: string) => void;\n translationsForLanguage?: Partial<typeof enTranslations>;\n};\n\ntype I18NextConfig = {\n debug: boolean;\n fallbackLng: false | FallbackLng;\n interpolation: { escapeValue: boolean };\n keySeparator: false | string;\n lng: string;\n nsSeparator: false | string;\n parseMissingKeyHandler: (key: string) => string;\n};\n\n/**\n * Wrapper around [i18next](https://www.i18next.com/) class for Stream related translations.\n * Instance of this class should be provided to Chat component to handle translations.\n * Stream provides following list of in-built translations:\n * 1. English (en)\n * 2. Dutch (nl)\n * 3. Russian (ru)\n * 4. Turkish (tr)\n * 5. French (fr)\n * 6. Italian (it)\n * 7. Hindi (hi)\n *\n * Simplest way to start using chat components in one of the in-built languages would be following:\n *\n * ```\n * const i18n = new Streami18n({ language 'nl' });\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * If you would like to override certain keys in in-built translation.\n * UI will be automatically updated in this case.\n *\n * ```\n * const i18n = new Streami18n({\n * language: 'nl',\n * translationsForLanguage: {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * }\n * });\n *\n * If you would like to register additional languages, use registerTranslation. You can add as many languages as you want:\n *\n * i18n.registerTranslation('zh', {\n * 'Nothing yet...': 'Nog Niet ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} en {{ secondUser }} zijn aan het typen...',\n * });\n *\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * You can use the same function to add whole new language as well.\n *\n * ```\n * const i18n = new Streami18n();\n *\n * i18n.registerTranslation('mr', {\n * 'Nothing yet...': 'काहीही नाही ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',\n * });\n *\n * // Make sure to call setLanguage to reflect new language in UI.\n * i18n.setLanguage('it');\n * <Chat client={chatClient} i18nInstance={i18n}>\n * ...\n * </Chat>\n * ```\n *\n * ## Datetime translations\n *\n * Stream react chat components uses [dayjs](https://day.js.org/en/) internally by default to format datetime stamp.\n * e.g., in ChannelPreview, MessageContent components.\n * Dayjs has locale support as well - https://day.js.org/docs/en/i18n/i18n\n * Dayjs is a lightweight alternative to Momentjs with the same modern API.\n *\n * Dayjs provides locale config for plenty of languages, you can check the whole list of locale configs at following url\n * https://github.com/iamkun/dayjs/tree/dev/src/locale\n *\n * You can either provide the dayjs locale config while registering\n * language with Streami18n (either via constructor or registerTranslation()) or you can provide your own Dayjs or Moment instance\n * to Streami18n constructor, which will be then used internally (using the language locale) in components.\n *\n * 1. Via language registration\n *\n * e.g.,\n * ```\n * const i18n = new Streami18n({\n * language: 'nl',\n * dayjsLocaleConfigForLanguage: {\n * months: [...],\n * monthsShort: [...],\n * calendar: {\n * sameDay: ...'\n * }\n * }\n * });\n * ```\n *\n * Similarly, you can add locale config for moment while registering translation via `registerTranslation` function.\n *\n * e.g.,\n * ```\n * const i18n = new Streami18n();\n *\n * i18n.registerTranslation(\n * 'mr',\n * {\n * 'Nothing yet...': 'काहीही नाही ...',\n * '{{ firstUser }} and {{ secondUser }} are typing...': '{{ firstUser }} आणि {{ secondUser }} टीपी करत आहेत ',\n * },\n * {\n * months: [...],\n * monthsShort: [...],\n * calendar: {\n * sameDay: ...'\n * }\n * }\n * );\n *```\n * 2. Provide your own Moment object\n *\n * ```js\n * import 'moment/locale/nl';\n * import 'moment/locale/it';\n * // or if you want to include all locales\n * import 'moment/min/locales';\n *\n * import Moment from moment\n *\n * const i18n = new Streami18n({\n * language: 'nl',\n * DateTimeParser: Moment\n * })\n * ```\n *\n * 3. Provide your own Dayjs object\n *\n * ```js\n * import Dayjs from 'dayjs'\n *\n * import 'dayjs/locale/nl';\n * import 'dayjs/locale/it';\n * // or if you want to include all locales\n * import 'dayjs/min/locales';\n *\n * const i18n = new Streami18n({\n * language: 'nl',\n * DateTimeParser: Dayjs\n * })\n * ```\n * If you would like to stick with english language for date-times in Stream components, you can set `disableDateTimeTranslations` to true.\n *\n */\nconst defaultStreami18nOptions = {\n DateTimeParser: Dayjs,\n dayjsLocaleConfigForLanguage: null,\n debug: false,\n disableDateTimeTranslations: false,\n language: 'en',\n logger: (msg?: string) => console.warn(msg),\n};\n\nexport class Streami18n {\n i18nInstance = i18n.createInstance();\n Dayjs = null;\n setLanguageCallback: (t: TFunction) => void = () => null;\n initialized = false;\n\n t: TFunction = (key: string) => key;\n tDateTimeParser: TDateTimeParser;\n\n translations: {\n [key: string]: {\n [key: string]: Partial<typeof enTranslations> | DefaultStreamChatGenerics;\n };\n } = {\n en: { [defaultNS]: enTranslations },\n fr: { [defaultNS]: frTranslations },\n he: { [defaultNS]: heTranslations },\n hi: { [defaultNS]: hiTranslations },\n it: { [defaultNS]: itTranslations },\n ja: { [defaultNS]: jaTranslations },\n ko: { [defaultNS]: koTranslations },\n nl: { [defaultNS]: nlTranslations },\n ru: { [defaultNS]: ruTranslations },\n tr: { [defaultNS]: trTranslations },\n };\n\n /**\n * dayjs.defineLanguage('nl') also changes the global locale. We don't want to do that\n * when a user calls the registerTranslation() function. So instead we will store the\n * locale configs given to the registerTranslation() function in `dayjsLocales` object,\n * and register the required locale with moment when setLanguage is called.\n */\n dayjsLocales: { [key: string]: Partial<ILocale> } = {};\n\n /**\n * Initialize properties used in constructor\n */\n logger: (msg?: string) => void;\n currentLanguage: string;\n DateTimeParser: typeof Dayjs | typeof moment;\n isCustomDateTimeParser: boolean;\n i18nextConfig: I18NextConfig;\n\n /**\n * Constructor accepts following options:\n * - language (String) default: 'en'\n * Language code e.g., en, tr\n *\n * - translationsForLanguage (object)\n * Translations object. Please check src/i18n/en.json for example.\n *\n * - disableDateTimeTranslations (boolean) default: false\n * Disable translations for date-times\n *\n * - debug (boolean) default: false\n * Enable debug mode in internal i18n class\n *\n * - logger (function) default: () => {}\n * Logger function to log warnings/errors from this class\n *\n * - dayjsLocaleConfigForLanguage (object) default: 'enConfig'\n * [Config object](https://momentjs.com/docs/#/i18n/changing-locale/) for internal moment object,\n * corresponding to language (param)\n *\n * - DateTimeParser (function) Moment or Dayjs instance/function.\n * Make sure to load all the required locales in this Moment or Dayjs instance that you will be provide to Streami18n\n *\n * @param {*} options\n */\n constructor(options: Options = {}, i18nextConfig: Partial<I18NextConfig> = {}) {\n const finalOptions = {\n ...defaultStreami18nOptions,\n ...options,\n };\n\n // Prepare the i18next configuration.\n this.logger = finalOptions.logger;\n\n this.currentLanguage = finalOptions.language;\n this.DateTimeParser = finalOptions.DateTimeParser;\n\n try {\n /**\n * This is a shallow check to see if the given parser is an instance of Dayjs.\n * For some reason Dayjs.isDayjs(this.DateTimeParser()) doesn't work.\n */\n if (this.DateTimeParser && isDayJs(this.DateTimeParser)) {\n this.DateTimeParser.extend(LocalizedFormat);\n this.DateTimeParser.extend(calendar);\n this.DateTimeParser.extend(localeData);\n this.DateTimeParser.extend(relativeTime);\n }\n } catch (error) {\n throw new Error(\n `Streami18n: Looks like you wanted to provide a Dayjs instance but something went wrong while adding plugins ${JSON.stringify(\n error,\n )}`,\n );\n }\n\n this.isCustomDateTimeParser = !!options.DateTimeParser;\n const translationsForLanguage = finalOptions.translationsForLanguage;\n\n if (translationsForLanguage) {\n this.translations[this.currentLanguage] = {\n [defaultNS]:\n this.translations[this.currentLanguage] &&\n this.translations[this.currentLanguage][defaultNS]\n ? {\n ...this.translations[this.currentLanguage][defaultNS],\n ...translationsForLanguage,\n }\n : translationsForLanguage,\n };\n }\n\n // If translations don't exist for given language, then set it as empty object.\n if (!this.translations[this.currentLanguage]) {\n this.translations[this.currentLanguage] = {\n [defaultNS]: {},\n };\n }\n\n this.i18nextConfig = {\n debug: finalOptions.debug,\n fallbackLng: false,\n interpolation: { escapeValue: false },\n keySeparator: false,\n lng: this.currentLanguage,\n nsSeparator: false,\n\n parseMissingKeyHandler: (key: string) => {\n this.logger(`Streami18n: Missing translation for key: ${key}`);\n\n return key;\n },\n ...i18nextConfig,\n };\n\n this.validateCurrentLanguage();\n\n const dayjsLocaleConfigForLanguage = finalOptions.dayjsLocaleConfigForLanguage;\n\n if (dayjsLocaleConfigForLanguage) {\n this.addOrUpdateLocale(this.currentLanguage, {\n ...dayjsLocaleConfigForLanguage,\n });\n } else if (!this.localeExists(this.currentLanguage)) {\n this.logger(\n `Streami18n: Streami18n(...) - Locale config for ${this.currentLanguage} does not exist in momentjs.` +\n `Please import the locale file using \"import 'moment/locale/${this.currentLanguage}';\" in your app or ` +\n `register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`,\n );\n }\n\n this.tDateTimeParser = (timestamp) => {\n if (finalOptions.disableDateTimeTranslations || !this.localeExists(this.currentLanguage)) {\n /**\n * TS needs to know which is being called to accept the chain call\n */\n if (isDayJs(this.DateTimeParser)) {\n return this.DateTimeParser(timestamp).locale(defaultLng);\n }\n return this.DateTimeParser(timestamp).locale(defaultLng);\n }\n if (isDayJs(this.DateTimeParser)) {\n return this.DateTimeParser(timestamp).locale(this.currentLanguage);\n }\n return this.DateTimeParser(timestamp).locale(this.currentLanguage);\n };\n }\n\n /**\n * Initializes the i18next instance with configuration (which enables natural language as default keys)\n */\n async init() {\n this.validateCurrentLanguage();\n\n try {\n this.t = await this.i18nInstance.init({\n ...this.i18nextConfig,\n lng: this.currentLanguage,\n resources: this.translations,\n });\n this.initialized = true;\n } catch (error) {\n this.logger(`Something went wrong with init: ${JSON.stringify(error)}`);\n }\n\n return {\n t: this.t,\n tDateTimeParser: this.tDateTimeParser,\n };\n }\n\n localeExists = (language: string) => {\n if (this.isCustomDateTimeParser) return true;\n\n return Object.keys(Dayjs.Ls).indexOf(language) > -1;\n };\n\n validateCurrentLanguage = () => {\n const availableLanguages = Object.keys(this.translations);\n if (availableLanguages.indexOf(this.currentLanguage) === -1) {\n this.logger(\n `Streami18n: '${this.currentLanguage}' language is not registered.` +\n ` Please make sure to call streami18n.registerTranslation('${this.currentLanguage}', {...}) or ` +\n `use one the built-in supported languages - ${this.getAvailableLanguages()}`,\n );\n\n this.currentLanguage = defaultLng;\n }\n };\n\n /** Returns an instance of i18next used within this class instance */\n geti18Instance = () => this.i18nInstance;\n\n /** Returns list of available languages. */\n getAvailableLanguages = () => Object.keys(this.translations);\n\n /** Returns all the translation dictionary for all inbuilt-languages */\n getTranslations = () => this.translations;\n\n /**\n * Returns current version translator function.\n */\n async getTranslators() {\n if (!this.initialized) {\n if (this.dayjsLocales[this.currentLanguage]) {\n this.addOrUpdateLocale(this.currentLanguage, this.dayjsLocales[this.currentLanguage]);\n }\n return await this.init();\n } else {\n return {\n t: this.t,\n tDateTimeParser: this.tDateTimeParser,\n };\n }\n }\n\n /**\n * Register translation\n */\n registerTranslation(\n language: string,\n translation: Partial<typeof enTranslations> | DefaultStreamChatGenerics,\n customDayjsLocale?: Partial<ILocale>,\n ) {\n if (!translation) {\n this.logger(\n `Streami18n: registerTranslation(language, translation, customDayjsLocale) called without translation`,\n );\n return;\n }\n\n if (!this.translations[language]) {\n this.translations[language] = { [defaultNS]: translation };\n } else {\n this.translations[language][defaultNS] = translation;\n }\n\n if (customDayjsLocale) {\n this.dayjsLocales[language] = { ...customDayjsLocale };\n } else if (!this.localeExists(language)) {\n this.logger(\n `Streami18n: registerTranslation(language, translation, customDayjsLocale) - ` +\n `Locale config for ${language} does not exist in Dayjs.` +\n `Please import the locale file using \"import 'dayjs/locale/${language}';\" in your app or ` +\n `register the locale config with Streami18n using registerTranslation(language, translation, customDayjsLocale)`,\n );\n }\n\n if (this.initialized) {\n this.i18nInstance.addResources(language, defaultNS, translation);\n }\n }\n\n addOrUpdateLocale(key: string, config: Partial<ILocale>) {\n if (this.localeExists(key)) {\n Dayjs.updateLocale(key, { ...config });\n } else {\n // Merging the custom locale config with en config, so missing keys can default to english.\n Dayjs.locale({ name: key, ...en_locale, ...config }, undefined, true);\n }\n }\n\n /**\n * Changes the language.\n */\n async setLanguage(language: string) {\n this.currentLanguage = language;\n\n if (!this.initialized) return;\n\n try {\n const t = await this.i18nInstance.changeLanguage(language);\n if (this.dayjsLocales[language]) {\n this.addOrUpdateLocale(this.currentLanguage, this.dayjsLocales[this.currentLanguage]);\n }\n this.setLanguageCallback(t);\n\n return t;\n } catch (error) {\n this.logger(`Failed to set language: ${JSON.stringify(error)}`);\n return this.t;\n }\n }\n\n registerSetLanguageCallback(callback: (t: TFunction) => void) {\n this.setLanguageCallback = callback;\n }\n}\n"]}
|
package/lib/module/version.json
CHANGED
|
@@ -15,7 +15,7 @@ export declare type ChannelListProps<StreamChatGenerics extends DefaultStreamCha
|
|
|
15
15
|
/**
|
|
16
16
|
* Custom UI component to display the list of channels
|
|
17
17
|
*
|
|
18
|
-
* Default: [ChannelListMessenger](https://getstream.
|
|
18
|
+
* Default: [ChannelListMessenger](https://getstream.io/chat/docs/sdk/reactnative/ui-components/channel-list-messenger/)
|
|
19
19
|
*/
|
|
20
20
|
List?: React.ComponentType<ChannelListMessengerProps<StreamChatGenerics>>;
|
|
21
21
|
/**
|
|
@@ -12,11 +12,11 @@ export declare type MessageInputProps<StreamChatGenerics extends DefaultStreamCh
|
|
|
12
12
|
/**
|
|
13
13
|
* UI Component for message input
|
|
14
14
|
* It's a consumer of
|
|
15
|
-
* [Channel Context](https://getstream.
|
|
16
|
-
* [Chat Context](https://getstream.
|
|
17
|
-
* [MessageInput Context](https://getstream.
|
|
18
|
-
* [Suggestions Context](https://getstream.
|
|
19
|
-
* [Translation Context](https://getstream.
|
|
15
|
+
* [Channel Context](https://getstream.io/chat/docs/sdk/reactnative/contexts/channel-context/),
|
|
16
|
+
* [Chat Context](https://getstream.io/chat/docs/sdk/reactnative/contexts/chat-context/),
|
|
17
|
+
* [MessageInput Context](https://getstream.io/chat/docs/sdk/reactnative/contexts/message-input-context/),
|
|
18
|
+
* [Suggestions Context](https://getstream.io/chat/docs/sdk/reactnative/contexts/suggestions-context/), and
|
|
19
|
+
* [Translation Context](https://getstream.io/chat/docs/sdk/reactnative/contexts/translation-context/)
|
|
20
20
|
*/
|
|
21
21
|
export declare const MessageInput: {
|
|
22
22
|
<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(props: Partial<MessageInputPropsWithContext<StreamChatGenerics>>): JSX.Element;
|
|
@@ -8,12 +8,12 @@ import type { MessageListProps } from '../MessageList/MessageList';
|
|
|
8
8
|
declare type ThreadPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ChatContextValue<StreamChatGenerics>, 'client'> & Pick<MessagesContextValue<StreamChatGenerics>, 'MessageList'> & Pick<ThreadContextValue<StreamChatGenerics>, 'closeThread' | 'loadMoreThread' | 'reloadThread' | 'thread'> & {
|
|
9
9
|
/**
|
|
10
10
|
* Additional props for underlying MessageInput component.
|
|
11
|
-
* Available props - https://getstream.
|
|
11
|
+
* Available props - https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-input/#props
|
|
12
12
|
* */
|
|
13
13
|
additionalMessageInputProps?: Partial<MessageInputProps<StreamChatGenerics>>;
|
|
14
14
|
/**
|
|
15
15
|
* Additional props for underlying MessageList component.
|
|
16
|
-
* Available props - https://getstream.
|
|
16
|
+
* Available props - https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-list/#props
|
|
17
17
|
* */
|
|
18
18
|
additionalMessageListProps?: Partial<MessageListProps<StreamChatGenerics>>;
|
|
19
19
|
/** Make input focus on mounting thread */
|
|
@@ -24,7 +24,7 @@ declare type ThreadPropsWithContext<StreamChatGenerics extends DefaultStreamChat
|
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
* **Customized MessageInput component to used within Thread instead of default MessageInput
|
|
27
|
-
* **Available from [MessageInput](https://getstream.
|
|
27
|
+
* **Available from [MessageInput](https://getstream.io/chat/docs/sdk/reactnative/ui-components/message-input)**
|
|
28
28
|
*/
|
|
29
29
|
MessageInput?: React.ComponentType<MessageInputProps<StreamChatGenerics>>;
|
|
30
30
|
/**
|
|
@@ -37,7 +37,7 @@ export declare type ThreadProps<StreamChatGenerics extends DefaultStreamChatGene
|
|
|
37
37
|
* Thread - The Thread renders a parent message with a list of replies. Use the standard message list of the main channel's messages.
|
|
38
38
|
* The thread is only used for the list of replies to a message.
|
|
39
39
|
*
|
|
40
|
-
* Thread is a consumer of [channel context](https://getstream.
|
|
40
|
+
* Thread is a consumer of [channel context](https://getstream.io/chat/docs/sdk/reactnative/contexts/channel-context/)
|
|
41
41
|
* Underlying MessageList, MessageInput and Message components can be customized using props:
|
|
42
42
|
* - additionalMessageListProps
|
|
43
43
|
* - additionalMessageInputProps
|
|
@@ -41,13 +41,13 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
41
41
|
/**
|
|
42
42
|
* Custom indicator to use when channel list is empty
|
|
43
43
|
*
|
|
44
|
-
* Default: [EmptyStateIndicator](https://getstream.
|
|
44
|
+
* Default: [EmptyStateIndicator](https://getstream.io/chat/docs/sdk/reactnative/core-components/channel/#emptystateindicator)
|
|
45
45
|
* */
|
|
46
46
|
EmptyStateIndicator: React.ComponentType<EmptyStateProps>;
|
|
47
47
|
/**
|
|
48
48
|
* Custom loading indicator to display at bottom of the list, while loading further pages
|
|
49
49
|
*
|
|
50
|
-
* Default: [ChannelListFooterLoadingIndicator](https://getstream.
|
|
50
|
+
* Default: [ChannelListFooterLoadingIndicator](https://getstream.io/chat/docs/sdk/reactnative/contexts/channels-context/#footerloadingindicator)
|
|
51
51
|
*/
|
|
52
52
|
FooterLoadingIndicator: React.ComponentType;
|
|
53
53
|
/**
|
|
@@ -61,13 +61,13 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
61
61
|
/**
|
|
62
62
|
* Custom indicator to display error at top of list, if loading/pagination error occurs
|
|
63
63
|
*
|
|
64
|
-
* Default: [ChannelListHeaderErrorIndicator](https://getstream.
|
|
64
|
+
* Default: [ChannelListHeaderErrorIndicator](https://getstream.io/chat/docs/sdk/reactnative/contexts/channels-context/#headererrorindicator)
|
|
65
65
|
*/
|
|
66
66
|
HeaderErrorIndicator: React.ComponentType<HeaderErrorProps>;
|
|
67
67
|
/**
|
|
68
68
|
* Custom indicator to display network-down error at top of list, if there is connectivity issue
|
|
69
69
|
*
|
|
70
|
-
* Default: [ChannelListHeaderNetworkDownIndicator](https://getstream.
|
|
70
|
+
* Default: [ChannelListHeaderNetworkDownIndicator](https://getstream.io/chat/docs/sdk/reactnative/contexts/channels-context/#headernetworkdownindicator)
|
|
71
71
|
*/
|
|
72
72
|
HeaderNetworkDownIndicator: React.ComponentType;
|
|
73
73
|
/**
|
|
@@ -77,7 +77,7 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
77
77
|
/**
|
|
78
78
|
* Custom indicator to use when there is error in fetching channels
|
|
79
79
|
*
|
|
80
|
-
* Default: [LoadingErrorIndicator](https://getstream.
|
|
80
|
+
* Default: [LoadingErrorIndicator](https://getstream.io/chat/docs/sdk/reactnative/contexts/channels-context/#loadingerrorindicator)
|
|
81
81
|
* */
|
|
82
82
|
LoadingErrorIndicator: React.ComponentType<LoadingErrorProps>;
|
|
83
83
|
/**
|
|
@@ -109,7 +109,7 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
109
109
|
/**
|
|
110
110
|
* Custom UI component to display individual channel list items
|
|
111
111
|
*
|
|
112
|
-
* Default: [ChannelPreviewMessenger](https://getstream.
|
|
112
|
+
* Default: [ChannelPreviewMessenger](https://getstream.io/chat/docs/sdk/reactnative/ui-components/channel-preview-messenger/)
|
|
113
113
|
*/
|
|
114
114
|
Preview: React.ComponentType<ChannelPreviewMessengerProps<StreamChatGenerics>>;
|
|
115
115
|
/**
|
|
@@ -141,7 +141,7 @@ export declare type ChannelsContextValue<StreamChatGenerics extends DefaultStrea
|
|
|
141
141
|
/**
|
|
142
142
|
* Custom UI component to display loading channel skeletons
|
|
143
143
|
*
|
|
144
|
-
* Default: [Skeleton](https://getstream.
|
|
144
|
+
* Default: [Skeleton](https://getstream.io/chat/docs/sdk/reactnative/contexts/channels-context/#skeleton)
|
|
145
145
|
*/
|
|
146
146
|
Skeleton: React.ComponentType;
|
|
147
147
|
/**
|