@sendbird/uikit-react-native 2.4.2 → 2.5.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ChannelMessageList/index.js +319 -0
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -0
- package/lib/commonjs/components/ChatFlatList.js +30 -50
- package/lib/commonjs/components/ChatFlatList.js.map +1 -1
- package/lib/commonjs/components/MessageSearchResultItem.js +132 -0
- package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -0
- package/lib/commonjs/components/ScrollToBottomButton.js +1 -1
- package/lib/commonjs/components/ScrollToBottomButton.js.map +1 -1
- package/lib/commonjs/constants.js +6 -2
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +2 -2
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +4 -2
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +4 -2
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js +4 -2
- package/lib/commonjs/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +84 -301
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +2 -0
- package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +9 -2
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +18 -4
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js +105 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchHeader.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchList.js +40 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchList.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusEmpty.js +22 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusEmpty.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusError.js +26 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusError.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusLoading.js +22 -0
- package/lib/commonjs/domain/messageSearch/component/MessageSearchStatusLoading.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/index.js +62 -0
- package/lib/commonjs/domain/messageSearch/index.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/module/createMessageSearchModule.js +36 -0
- package/lib/commonjs/domain/messageSearch/module/createMessageSearchModule.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/module/moduleContext.js +25 -0
- package/lib/commonjs/domain/messageSearch/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/messageSearch/types.js +6 -0
- package/lib/commonjs/domain/messageSearch/types.js.map +1 -0
- package/lib/commonjs/domain/openChannel/component/OpenChannelMessageList.js +38 -279
- package/lib/commonjs/domain/openChannel/component/OpenChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/openChannel/module/moduleContext.js +9 -2
- package/lib/commonjs/domain/openChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/openChannel/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +107 -15
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js +2 -0
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js +145 -0
- package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -0
- package/lib/commonjs/fragments/createOpenChannelFragment.js +40 -8
- package/lib/commonjs/fragments/createOpenChannelFragment.js.map +1 -1
- package/lib/commonjs/hooks/useMentionSuggestion.js +17 -0
- package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -1
- package/lib/commonjs/index.js +60 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/localization/createBaseStringSet.js +33 -20
- package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
- package/lib/commonjs/utils/pubsub.js +21 -0
- package/lib/commonjs/utils/pubsub.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +311 -0
- package/lib/module/components/ChannelMessageList/index.js.map +1 -0
- package/lib/module/components/ChatFlatList.js +32 -52
- package/lib/module/components/ChatFlatList.js.map +1 -1
- package/lib/module/components/MessageSearchResultItem.js +124 -0
- package/lib/module/components/MessageSearchResultItem.js.map +1 -0
- package/lib/module/components/ScrollToBottomButton.js +1 -1
- package/lib/module/components/ScrollToBottomButton.js.map +1 -1
- package/lib/module/constants.js +3 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +2 -2
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +4 -2
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +4 -2
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelHeader.js +4 -2
- package/lib/module/domain/groupChannel/component/GroupChannelHeader.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +88 -305
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +2 -0
- package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +9 -2
- package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +18 -4
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/module/domain/messageSearch/component/MessageSearchHeader.js +96 -0
- package/lib/module/domain/messageSearch/component/MessageSearchHeader.js.map +1 -0
- package/lib/module/domain/messageSearch/component/MessageSearchList.js +32 -0
- package/lib/module/domain/messageSearch/component/MessageSearchList.js.map +1 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusEmpty.js +14 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusEmpty.js.map +1 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusError.js +18 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusError.js.map +1 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusLoading.js +14 -0
- package/lib/module/domain/messageSearch/component/MessageSearchStatusLoading.js.map +1 -0
- package/lib/module/domain/messageSearch/index.js +8 -0
- package/lib/module/domain/messageSearch/index.js.map +1 -0
- package/lib/module/domain/messageSearch/module/createMessageSearchModule.js +28 -0
- package/lib/module/domain/messageSearch/module/createMessageSearchModule.js.map +1 -0
- package/lib/module/domain/messageSearch/module/moduleContext.js +14 -0
- package/lib/module/domain/messageSearch/module/moduleContext.js.map +1 -0
- package/lib/module/domain/messageSearch/types.js +2 -0
- package/lib/module/domain/messageSearch/types.js.map +1 -0
- package/lib/module/domain/openChannel/component/OpenChannelMessageList.js +40 -281
- package/lib/module/domain/openChannel/component/OpenChannelMessageList.js.map +1 -1
- package/lib/module/domain/openChannel/module/moduleContext.js +9 -2
- package/lib/module/domain/openChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/openChannel/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +109 -17
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelSettingsFragment.js +2 -0
- package/lib/module/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js +135 -0
- package/lib/module/fragments/createMessageSearchFragment.js.map +1 -0
- package/lib/module/fragments/createOpenChannelFragment.js +41 -9
- package/lib/module/fragments/createOpenChannelFragment.js.map +1 -1
- package/lib/module/hooks/useMentionSuggestion.js +18 -1
- package/lib/module/hooks/useMentionSuggestion.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/localization/createBaseStringSet.js +34 -21
- package/lib/module/localization/createBaseStringSet.js.map +1 -1
- package/lib/module/utils/pubsub.js +14 -0
- package/lib/module/utils/pubsub.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +55 -0
- package/lib/typescript/src/components/ChatFlatList.d.ts +7 -8
- package/lib/typescript/src/components/MessageRenderer/index.d.ts +4 -0
- package/lib/typescript/src/components/MessageSearchResultItem.d.ts +2 -0
- package/lib/typescript/src/components/OpenChannelMessageRenderer/index.d.ts +1 -0
- package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
- package/lib/typescript/src/constants.d.ts +3 -1
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +2 -1
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +3 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelHeader.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +3 -32
- package/lib/typescript/src/domain/groupChannel/types.d.ts +23 -35
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +2 -0
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchHeader.d.ts +3 -0
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchList.d.ts +3 -0
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusEmpty.d.ts +2 -0
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusError.d.ts +3 -0
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusLoading.d.ts +2 -0
- package/lib/typescript/src/domain/messageSearch/index.d.ts +7 -0
- package/lib/typescript/src/domain/messageSearch/module/createMessageSearchModule.d.ts +3 -0
- package/lib/typescript/src/domain/messageSearch/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/messageSearch/types.d.ts +53 -0
- package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -37
- package/lib/typescript/src/domain/openChannel/types.d.ts +17 -36
- package/lib/typescript/src/fragments/createMessageSearchFragment.d.ts +3 -0
- package/lib/typescript/src/hooks/useMentionSuggestion.d.ts +3 -2
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/localization/StringSet.type.d.ts +17 -3
- package/lib/typescript/src/utils/pubsub.d.ts +6 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +8 -7
- package/src/components/ChannelMessageList/index.tsx +392 -0
- package/src/components/ChatFlatList.tsx +33 -51
- package/src/components/MessageSearchResultItem.tsx +125 -0
- package/src/components/ScrollToBottomButton.tsx +3 -4
- package/src/constants.ts +3 -1
- package/src/containers/GroupChannelPreviewContainer.tsx +2 -2
- package/src/containers/SendbirdUIKitContainer.tsx +2 -0
- package/src/contexts/SendbirdChatCtx.tsx +7 -1
- package/src/domain/groupChannel/component/GroupChannelHeader.tsx +9 -3
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +73 -316
- package/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.tsx +2 -1
- package/src/domain/groupChannel/module/moduleContext.tsx +10 -2
- package/src/domain/groupChannel/types.ts +49 -38
- package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +29 -13
- package/src/domain/groupChannelSettings/types.ts +2 -0
- package/src/domain/messageSearch/component/MessageSearchHeader.tsx +98 -0
- package/src/domain/messageSearch/component/MessageSearchList.tsx +26 -0
- package/src/domain/messageSearch/component/MessageSearchStatusEmpty.tsx +15 -0
- package/src/domain/messageSearch/component/MessageSearchStatusError.tsx +16 -0
- package/src/domain/messageSearch/component/MessageSearchStatusLoading.tsx +15 -0
- package/src/domain/messageSearch/index.ts +7 -0
- package/src/domain/messageSearch/module/createMessageSearchModule.tsx +21 -0
- package/src/domain/messageSearch/module/moduleContext.tsx +16 -0
- package/src/domain/messageSearch/types.ts +55 -0
- package/src/domain/openChannel/component/OpenChannelMessageList.tsx +35 -303
- package/src/domain/openChannel/module/moduleContext.tsx +8 -2
- package/src/domain/openChannel/types.ts +40 -38
- package/src/fragments/createGroupChannelFragment.tsx +114 -17
- package/src/fragments/createGroupChannelSettingsFragment.tsx +2 -0
- package/src/fragments/createMessageSearchFragment.tsx +159 -0
- package/src/fragments/createOpenChannelFragment.tsx +48 -12
- package/src/hooks/useMentionSuggestion.ts +23 -3
- package/src/index.ts +3 -0
- package/src/localization/StringSet.type.ts +20 -2
- package/src/localization/createBaseStringSet.ts +22 -2
- package/src/utils/pubsub.ts +20 -0
- package/src/version.ts +0 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { FlatListProps } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';
|
|
5
4
|
import type {
|
|
@@ -16,7 +15,9 @@ import type {
|
|
|
16
15
|
} from '@sendbird/uikit-utils';
|
|
17
16
|
|
|
18
17
|
import type { ChannelInputProps, SuggestedMentionListProps } from '../../components/ChannelInput';
|
|
18
|
+
import type { ChannelMessageListProps } from '../../components/ChannelMessageList';
|
|
19
19
|
import type { CommonComponent } from '../../types';
|
|
20
|
+
import type { PubSub } from '../../utils/pubsub';
|
|
20
21
|
|
|
21
22
|
export interface GroupChannelProps {
|
|
22
23
|
Fragment: {
|
|
@@ -44,50 +45,44 @@ export interface GroupChannelProps {
|
|
|
44
45
|
collectionCreator?: UseGroupChannelMessagesOptions['collectionCreator'];
|
|
45
46
|
queryCreator?: UseGroupChannelMessagesOptions['queryCreator'];
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
searchItem?: GroupChannelProps['MessageList']['searchItem'];
|
|
49
|
+
|
|
50
|
+
/** @deprecated Please use `onPressMediaMessage` instead **/
|
|
48
51
|
onPressImageMessage?: GroupChannelProps['MessageList']['onPressImageMessage'];
|
|
49
52
|
};
|
|
50
53
|
Header: {
|
|
54
|
+
shouldHideRight: () => boolean;
|
|
51
55
|
onPressHeaderLeft: () => void;
|
|
52
56
|
onPressHeaderRight: () => void;
|
|
53
57
|
};
|
|
54
|
-
MessageList:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
MessageList: Pick<
|
|
59
|
+
ChannelMessageListProps<SendbirdGroupChannel>,
|
|
60
|
+
| 'enableMessageGrouping'
|
|
61
|
+
| 'currentUserId'
|
|
62
|
+
| 'channel'
|
|
63
|
+
| 'messages'
|
|
64
|
+
| 'newMessages'
|
|
65
|
+
| 'scrolledAwayFromBottom'
|
|
66
|
+
| 'onScrolledAwayFromBottom'
|
|
67
|
+
| 'onTopReached'
|
|
68
|
+
| 'onBottomReached'
|
|
69
|
+
| 'onResendFailedMessage'
|
|
70
|
+
| 'onDeleteMessage'
|
|
71
|
+
| 'onPressMediaMessage'
|
|
72
|
+
| 'renderMessage'
|
|
73
|
+
| 'renderNewMessagesButton'
|
|
74
|
+
| 'renderScrollToBottomButton'
|
|
75
|
+
| 'flatListProps'
|
|
76
|
+
| 'onPressImageMessage'
|
|
77
|
+
| 'hasNext'
|
|
78
|
+
| 'searchItem'
|
|
79
|
+
> & {
|
|
80
|
+
onResetMessageList: (callback?: () => void) => void;
|
|
67
81
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onPress?: () => void;
|
|
73
|
-
onLongPress?: () => void;
|
|
74
|
-
channel: GroupChannelProps['MessageList']['channel'];
|
|
75
|
-
currentUserId?: GroupChannelProps['MessageList']['currentUserId'];
|
|
76
|
-
enableMessageGrouping: GroupChannelProps['MessageList']['enableMessageGrouping'];
|
|
77
|
-
}) => React.ReactElement | null;
|
|
78
|
-
renderNewMessagesButton: null | CommonComponent<{
|
|
79
|
-
visible: boolean;
|
|
80
|
-
onPress: () => void;
|
|
81
|
-
newMessages: SendbirdMessage[];
|
|
82
|
-
}>;
|
|
83
|
-
renderScrollToBottomButton: null | CommonComponent<{
|
|
84
|
-
visible: boolean;
|
|
85
|
-
onPress: () => void;
|
|
86
|
-
}>;
|
|
87
|
-
flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;
|
|
88
|
-
|
|
89
|
-
/** @deprecated `onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead **/
|
|
90
|
-
onPressImageMessage?: (message: SendbirdFileMessage, uri: string) => void;
|
|
82
|
+
/** @deprecated Please use `newMessages` instead */
|
|
83
|
+
newMessagesFromMembers: SendbirdMessage[];
|
|
84
|
+
/** @deprecated Please use `newMessages` instead */
|
|
85
|
+
nextMessages: SendbirdMessage[];
|
|
91
86
|
};
|
|
92
87
|
Input: Pick<
|
|
93
88
|
ChannelInputProps,
|
|
@@ -108,6 +103,7 @@ export interface GroupChannelProps {
|
|
|
108
103
|
channel: SendbirdGroupChannel;
|
|
109
104
|
enableTypingIndicator: boolean;
|
|
110
105
|
keyboardAvoidOffset?: number;
|
|
106
|
+
groupChannelPubSub: PubSub<GroupChannelPubSubContextPayload>;
|
|
111
107
|
};
|
|
112
108
|
}
|
|
113
109
|
|
|
@@ -127,6 +123,7 @@ export interface GroupChannelContextsType {
|
|
|
127
123
|
TypingIndicator: React.Context<{
|
|
128
124
|
typingUsers: SendbirdUser[];
|
|
129
125
|
}>;
|
|
126
|
+
PubSub: React.Context<PubSub<GroupChannelPubSubContextPayload>>;
|
|
130
127
|
}
|
|
131
128
|
export interface GroupChannelModule {
|
|
132
129
|
Provider: CommonComponent<GroupChannelProps['Provider']>;
|
|
@@ -139,3 +136,17 @@ export interface GroupChannelModule {
|
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
export type GroupChannelFragment = CommonComponent<GroupChannelProps['Fragment']>;
|
|
139
|
+
|
|
140
|
+
export type GroupChannelPubSubContextPayload =
|
|
141
|
+
| {
|
|
142
|
+
type: 'MESSAGE_SENT_PENDING' | 'MESSAGE_SENT_SUCCESS';
|
|
143
|
+
data: {
|
|
144
|
+
message: SendbirdUserMessage | SendbirdFileMessage;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
| {
|
|
148
|
+
type: 'MESSAGES_RECEIVED';
|
|
149
|
+
data: {
|
|
150
|
+
messages: SendbirdMessage[];
|
|
151
|
+
};
|
|
152
|
+
};
|
|
@@ -11,10 +11,12 @@ import { GroupChannelSettingsContexts } from '../module/moduleContext';
|
|
|
11
11
|
import type { GroupChannelSettingsProps } from '../types';
|
|
12
12
|
|
|
13
13
|
let WARN_onPressMenuNotification = false;
|
|
14
|
+
let WARN_onPressMenuSearchInChannel = false;
|
|
14
15
|
|
|
15
16
|
const GroupChannelSettingsMenu = ({
|
|
16
17
|
onPressMenuModeration,
|
|
17
18
|
onPressMenuMembers,
|
|
19
|
+
onPressMenuSearchInChannel,
|
|
18
20
|
onPressMenuLeaveChannel,
|
|
19
21
|
onPressMenuNotification,
|
|
20
22
|
menuItemsCreator = (menu) => menu,
|
|
@@ -24,11 +26,16 @@ const GroupChannelSettingsMenu = ({
|
|
|
24
26
|
const { STRINGS } = useLocalization();
|
|
25
27
|
const { colors } = useUIKitTheme();
|
|
26
28
|
|
|
27
|
-
if (__DEV__ && !WARN_onPressMenuNotification && !onPressMenuNotification) {
|
|
28
|
-
Logger.warn('
|
|
29
|
+
if (__DEV__ && !WARN_onPressMenuNotification && !onPressMenuNotification && features.userMentionEnabled) {
|
|
30
|
+
Logger.warn('If you are using mention, make sure to pass the `onPressMenuNotification` prop');
|
|
29
31
|
WARN_onPressMenuNotification = true;
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
if (__DEV__ && !WARN_onPressMenuSearchInChannel && !onPressMenuSearchInChannel && features.messageSearchEnabled) {
|
|
35
|
+
Logger.warn('If you are using message search, make sure to pass the `onPressMenuSearchInChannel` prop');
|
|
36
|
+
WARN_onPressMenuSearchInChannel = true;
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
const toggleNotification = async () => {
|
|
33
40
|
if (channel.myPushTriggerOption === 'off') {
|
|
34
41
|
await channel.setMyPushTriggerOption(PushTriggerOption.DEFAULT);
|
|
@@ -88,19 +95,28 @@ const GroupChannelSettingsMenu = ({
|
|
|
88
95
|
actionLabel: String(channel.memberCount),
|
|
89
96
|
actionItem: <Icon icon={'chevron-right'} color={colors.onBackground01} />,
|
|
90
97
|
},
|
|
91
|
-
{
|
|
92
|
-
icon: 'leave',
|
|
93
|
-
iconColor: colors.error,
|
|
94
|
-
name: STRINGS.GROUP_CHANNEL_SETTINGS.MENU_LEAVE_CHANNEL,
|
|
95
|
-
onPress: () => {
|
|
96
|
-
channel.leave().then(() => {
|
|
97
|
-
onPressMenuLeaveChannel();
|
|
98
|
-
sdk.clearCachedMessages([channel.url]).catch();
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
98
|
]);
|
|
103
99
|
|
|
100
|
+
if (features.messageSearchEnabled) {
|
|
101
|
+
menuItems.push({
|
|
102
|
+
icon: 'search',
|
|
103
|
+
name: STRINGS.GROUP_CHANNEL_SETTINGS.MENU_SEARCH,
|
|
104
|
+
onPress: () => onPressMenuSearchInChannel?.(),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
menuItems.push({
|
|
109
|
+
icon: 'leave',
|
|
110
|
+
iconColor: colors.error,
|
|
111
|
+
name: STRINGS.GROUP_CHANNEL_SETTINGS.MENU_LEAVE_CHANNEL,
|
|
112
|
+
onPress: () => {
|
|
113
|
+
channel.leave().then(() => {
|
|
114
|
+
onPressMenuLeaveChannel();
|
|
115
|
+
sdk.clearCachedMessages([channel.url]).catch();
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
104
120
|
return (
|
|
105
121
|
<View>
|
|
106
122
|
{menuItems.map((menu) => {
|
|
@@ -11,6 +11,7 @@ export interface GroupChannelSettingsProps {
|
|
|
11
11
|
onPressHeaderLeft: GroupChannelSettingsProps['Header']['onPressHeaderLeft'];
|
|
12
12
|
onPressMenuModeration: GroupChannelSettingsProps['Menu']['onPressMenuModeration'];
|
|
13
13
|
onPressMenuMembers: GroupChannelSettingsProps['Menu']['onPressMenuMembers'];
|
|
14
|
+
onPressMenuSearchInChannel?: GroupChannelSettingsProps['Menu']['onPressMenuSearchInChannel'];
|
|
14
15
|
onPressMenuLeaveChannel: GroupChannelSettingsProps['Menu']['onPressMenuLeaveChannel'];
|
|
15
16
|
onPressMenuNotification?: GroupChannelSettingsProps['Menu']['onPressMenuNotification'];
|
|
16
17
|
menuItemsCreator?: GroupChannelSettingsProps['Menu']['menuItemsCreator'];
|
|
@@ -22,6 +23,7 @@ export interface GroupChannelSettingsProps {
|
|
|
22
23
|
Menu: {
|
|
23
24
|
onPressMenuModeration: () => void;
|
|
24
25
|
onPressMenuMembers: () => void;
|
|
26
|
+
onPressMenuSearchInChannel?: () => void;
|
|
25
27
|
onPressMenuLeaveChannel: () => void;
|
|
26
28
|
onPressMenuNotification?: () => void;
|
|
27
29
|
menuItemsCreator?: (defaultMenuItems: MenuBarProps[]) => MenuBarProps[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { Platform, TextInput } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Box,
|
|
6
|
+
Icon,
|
|
7
|
+
PressBox,
|
|
8
|
+
Text,
|
|
9
|
+
createStyleSheet,
|
|
10
|
+
useHeaderStyle,
|
|
11
|
+
useUIKitTheme,
|
|
12
|
+
} from '@sendbird/uikit-react-native-foundation';
|
|
13
|
+
|
|
14
|
+
import { useLocalization } from '../../../hooks/useContext';
|
|
15
|
+
import type { MessageSearchProps } from '../types';
|
|
16
|
+
|
|
17
|
+
const MessageSearchHeader = ({
|
|
18
|
+
keyword,
|
|
19
|
+
onChangeKeyword,
|
|
20
|
+
onPressHeaderLeft,
|
|
21
|
+
onPressHeaderRight,
|
|
22
|
+
}: MessageSearchProps['Header']) => {
|
|
23
|
+
const { HeaderComponent } = useHeaderStyle();
|
|
24
|
+
const { colors } = useUIKitTheme();
|
|
25
|
+
const { STRINGS } = useLocalization();
|
|
26
|
+
|
|
27
|
+
const inputRef = useRef<TextInput>(null);
|
|
28
|
+
const inputColor = colors.ui.input.default.active;
|
|
29
|
+
const searchEnabled = keyword.length > 0;
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
inputRef.current?.focus();
|
|
34
|
+
}, Platform.select({ ios: 500, default: 0 }));
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<HeaderComponent
|
|
39
|
+
clearTitleMargin
|
|
40
|
+
title={
|
|
41
|
+
<Box
|
|
42
|
+
flex={1}
|
|
43
|
+
height={36}
|
|
44
|
+
alignItems={'center'}
|
|
45
|
+
backgroundColor={inputColor.background}
|
|
46
|
+
borderRadius={24}
|
|
47
|
+
paddingHorizontal={10}
|
|
48
|
+
flexDirection={'row'}
|
|
49
|
+
>
|
|
50
|
+
<Icon size={24} icon={'search'} color={colors.onBackground03} containerStyle={styles.searchIcon} />
|
|
51
|
+
<TextInput
|
|
52
|
+
disableFullscreenUI
|
|
53
|
+
enablesReturnKeyAutomatically
|
|
54
|
+
ref={inputRef}
|
|
55
|
+
returnKeyType={'search'}
|
|
56
|
+
onSubmitEditing={() => onPressHeaderRight()}
|
|
57
|
+
selectionColor={colors.primary}
|
|
58
|
+
placeholder={STRINGS.MESSAGE_SEARCH.HEADER_INPUT_PLACEHOLDER}
|
|
59
|
+
placeholderTextColor={inputColor.placeholder}
|
|
60
|
+
style={[styles.input, { color: inputColor.text }]}
|
|
61
|
+
value={keyword}
|
|
62
|
+
onChangeText={onChangeKeyword}
|
|
63
|
+
/>
|
|
64
|
+
{searchEnabled && (
|
|
65
|
+
<PressBox onPress={() => onChangeKeyword('')}>
|
|
66
|
+
<Icon size={18} icon={'remove'} color={colors.onBackground03} containerStyle={styles.clearIcon} />
|
|
67
|
+
</PressBox>
|
|
68
|
+
)}
|
|
69
|
+
</Box>
|
|
70
|
+
}
|
|
71
|
+
left={<Icon icon={'arrow-left'} />}
|
|
72
|
+
onPressLeft={onPressHeaderLeft}
|
|
73
|
+
right={
|
|
74
|
+
<Text button color={searchEnabled ? colors.primary : colors.onBackground04}>
|
|
75
|
+
{STRINGS.MESSAGE_SEARCH.HEADER_RIGHT}
|
|
76
|
+
</Text>
|
|
77
|
+
}
|
|
78
|
+
onPressRight={searchEnabled ? onPressHeaderRight : undefined}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const styles = createStyleSheet({
|
|
84
|
+
searchIcon: {
|
|
85
|
+
marginRight: 8,
|
|
86
|
+
},
|
|
87
|
+
clearIcon: {
|
|
88
|
+
marginLeft: 8,
|
|
89
|
+
},
|
|
90
|
+
input: {
|
|
91
|
+
flex: 1,
|
|
92
|
+
height: '100%',
|
|
93
|
+
fontSize: 14,
|
|
94
|
+
padding: 0,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export default MessageSearchHeader;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatList, ListRenderItem } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { SendbirdBaseMessage, useFreshCallback } from '@sendbird/uikit-utils';
|
|
5
|
+
|
|
6
|
+
import type { MessageSearchProps } from '../types';
|
|
7
|
+
|
|
8
|
+
const MessageSearchList = ({
|
|
9
|
+
messages,
|
|
10
|
+
renderSearchResultItem,
|
|
11
|
+
flatListProps,
|
|
12
|
+
onPressSearchResultItem,
|
|
13
|
+
channel,
|
|
14
|
+
}: MessageSearchProps['List']) => {
|
|
15
|
+
const renderItem: ListRenderItem<SendbirdBaseMessage> = useFreshCallback(({ item }) => {
|
|
16
|
+
return renderSearchResultItem({
|
|
17
|
+
message: item,
|
|
18
|
+
onPress: () => onPressSearchResultItem({ message: item, channel }),
|
|
19
|
+
channel,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return <FlatList {...flatListProps} data={messages} renderItem={renderItem} />;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default MessageSearchList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
|
|
5
|
+
import TypedPlaceholder from '../../../components/TypedPlaceholder';
|
|
6
|
+
|
|
7
|
+
const MessageSearchStatusEmpty = () => {
|
|
8
|
+
return (
|
|
9
|
+
<Box flex={1} alignItems={'center'} justifyContent={'center'}>
|
|
10
|
+
<TypedPlaceholder type={'no-results-found'} />
|
|
11
|
+
</Box>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default MessageSearchStatusEmpty;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
|
|
5
|
+
import TypedPlaceholder from '../../../components/TypedPlaceholder';
|
|
6
|
+
import type { MessageSearchModule } from '../types';
|
|
7
|
+
|
|
8
|
+
const MessageSearchStatusError: MessageSearchModule['StatusError'] = ({ onPressRetry }) => {
|
|
9
|
+
return (
|
|
10
|
+
<Box flex={1} alignItems={'center'} justifyContent={'center'}>
|
|
11
|
+
<TypedPlaceholder type={'error-wrong'} onPressRetry={onPressRetry} />
|
|
12
|
+
</Box>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default MessageSearchStatusError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
|
|
5
|
+
import TypedPlaceholder from '../../../components/TypedPlaceholder';
|
|
6
|
+
|
|
7
|
+
const MessageSearchStatusLoading = () => {
|
|
8
|
+
return (
|
|
9
|
+
<Box flex={1} alignItems={'center'} justifyContent={'center'}>
|
|
10
|
+
<TypedPlaceholder type={'loading'} />
|
|
11
|
+
</Box>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default MessageSearchStatusLoading;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as MessageSearchHeader } from './component/MessageSearchHeader';
|
|
2
|
+
export { default as MessageSearchList } from './component/MessageSearchList';
|
|
3
|
+
export { default as MessageSearchStatusLoading } from './component/MessageSearchStatusLoading';
|
|
4
|
+
export { default as MessageSearchStatusEmpty } from './component/MessageSearchStatusEmpty';
|
|
5
|
+
export { default as MessageSearchStatusError } from './component/MessageSearchStatusError';
|
|
6
|
+
export { default as createMessageSearchModule } from './module/createMessageSearchModule';
|
|
7
|
+
export { MessageSearchContextsProvider, MessageSearchContexts } from './module/moduleContext';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import MessageSearchHeader from '../component/MessageSearchHeader';
|
|
2
|
+
import MessageSearchList from '../component/MessageSearchList';
|
|
3
|
+
import MessageSearchStatusEmpty from '../component/MessageSearchStatusEmpty';
|
|
4
|
+
import MessageSearchStatusError from '../component/MessageSearchStatusError';
|
|
5
|
+
import MessageSearchStatusLoading from '../component/MessageSearchStatusLoading';
|
|
6
|
+
import type { MessageSearchModule } from '../types';
|
|
7
|
+
import { MessageSearchContextsProvider } from './moduleContext';
|
|
8
|
+
|
|
9
|
+
const createMessageSearchModule = ({
|
|
10
|
+
Header = MessageSearchHeader,
|
|
11
|
+
List = MessageSearchList,
|
|
12
|
+
StatusError = MessageSearchStatusError,
|
|
13
|
+
StatusLoading = MessageSearchStatusLoading,
|
|
14
|
+
StatusEmpty = MessageSearchStatusEmpty,
|
|
15
|
+
Provider = MessageSearchContextsProvider,
|
|
16
|
+
...module
|
|
17
|
+
}: Partial<MessageSearchModule> = {}): MessageSearchModule => {
|
|
18
|
+
return { Header, List, Provider, StatusError, StatusEmpty, StatusLoading, ...module };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default createMessageSearchModule;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
import ProviderLayout from '../../../components/ProviderLayout';
|
|
4
|
+
import type { MessageSearchContextsType, MessageSearchModule } from '../types';
|
|
5
|
+
|
|
6
|
+
export const MessageSearchContexts: MessageSearchContextsType = {
|
|
7
|
+
Fragment: createContext(null),
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const MessageSearchContextsProvider: MessageSearchModule['Provider'] = ({ children }) => {
|
|
11
|
+
return (
|
|
12
|
+
<ProviderLayout>
|
|
13
|
+
<MessageSearchContexts.Fragment.Provider value={null}>{children}</MessageSearchContexts.Fragment.Provider>
|
|
14
|
+
</ProviderLayout>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { FlatListProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { SendbirdBaseMessage, SendbirdGroupChannel, SendbirdMessageSearchQuery } from '@sendbird/uikit-utils';
|
|
5
|
+
|
|
6
|
+
import type { CommonComponent } from '../../types';
|
|
7
|
+
|
|
8
|
+
export type MessageSearchProps = {
|
|
9
|
+
Fragment: {
|
|
10
|
+
channel: SendbirdGroupChannel;
|
|
11
|
+
onPressHeaderLeft: MessageSearchProps['Header']['onPressHeaderLeft'];
|
|
12
|
+
onPressSearchResultItem: MessageSearchProps['List']['onPressSearchResultItem'];
|
|
13
|
+
renderSearchResultItem?: MessageSearchProps['List']['renderSearchResultItem'];
|
|
14
|
+
queryCreator?: () => SendbirdMessageSearchQuery;
|
|
15
|
+
};
|
|
16
|
+
Header: {
|
|
17
|
+
keyword: string;
|
|
18
|
+
onChangeKeyword: (value: string) => void;
|
|
19
|
+
onPressHeaderLeft: () => void;
|
|
20
|
+
onPressHeaderRight: () => void;
|
|
21
|
+
};
|
|
22
|
+
List: {
|
|
23
|
+
channel: SendbirdGroupChannel;
|
|
24
|
+
messages: SendbirdBaseMessage[];
|
|
25
|
+
onPressSearchResultItem: (params: { channel: SendbirdGroupChannel; message: SendbirdBaseMessage }) => void;
|
|
26
|
+
renderSearchResultItem: (props: {
|
|
27
|
+
channel: SendbirdGroupChannel;
|
|
28
|
+
message: SendbirdBaseMessage;
|
|
29
|
+
onPress: () => void;
|
|
30
|
+
}) => React.ReactElement | null;
|
|
31
|
+
flatListProps?: Partial<FlatListProps<SendbirdBaseMessage>>;
|
|
32
|
+
};
|
|
33
|
+
StatusError: {
|
|
34
|
+
onPressRetry: () => void;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Internal context for MessageSearch
|
|
40
|
+
* For example, the developer can create a custom header
|
|
41
|
+
* with getting data from the domain context
|
|
42
|
+
* */
|
|
43
|
+
export type MessageSearchContextsType = {
|
|
44
|
+
Fragment: React.Context<null>;
|
|
45
|
+
};
|
|
46
|
+
export interface MessageSearchModule {
|
|
47
|
+
Provider: CommonComponent;
|
|
48
|
+
Header: CommonComponent<MessageSearchProps['Header']>;
|
|
49
|
+
List: CommonComponent<MessageSearchProps['List']>;
|
|
50
|
+
StatusEmpty: CommonComponent;
|
|
51
|
+
StatusLoading: CommonComponent;
|
|
52
|
+
StatusError: CommonComponent<MessageSearchProps['StatusError']>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type MessageSearchFragment = CommonComponent<MessageSearchProps['Fragment']>;
|