Skip to content

Commit 61eccf9

Browse files
committed
chore: rename ChannelPreviewMessenger
1 parent be25781 commit 61eccf9

File tree

10 files changed

+29
-31
lines changed

10 files changed

+29
-31
lines changed

examples/SampleApp/src/components/ChannelPreview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import {
4-
ChannelPreviewMessenger,
5-
ChannelPreviewMessengerProps,
4+
ChannelPreviewView,
5+
ChannelPreviewViewProps,
66
ChannelPreviewStatus,
77
ChannelPreviewStatusProps,
88
Pin,
@@ -54,6 +54,6 @@ const CustomChannelPreviewStatus = (props: ChannelPreviewStatusProps) => {
5454
);
5555
};
5656

57-
export const ChannelPreview: React.FC<ChannelPreviewMessengerProps> = (props) => {
58-
return <ChannelPreviewMessenger {...props} PreviewStatus={CustomChannelPreviewStatus} />;
57+
export const ChannelPreview: React.FC<ChannelPreviewViewProps> = (props) => {
58+
return <ChannelPreviewView {...props} PreviewStatus={CustomChannelPreviewStatus} />;
5959
};

examples/SampleApp/src/screens/SharedGroupsScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
ChannelList,
66
ChannelListView,
77
ChannelListViewProps,
8-
ChannelPreviewMessengerProps,
8+
ChannelPreviewViewProps,
99
getChannelPreviewDisplayAvatar,
1010
GroupAvatar,
1111
useChannelPreviewDisplayName,
@@ -55,7 +55,7 @@ const styles = StyleSheet.create({
5555
},
5656
});
5757

58-
type CustomPreviewProps = ChannelPreviewMessengerProps;
58+
type CustomPreviewProps = ChannelPreviewViewProps;
5959

6060
const CustomPreview: React.FC<CustomPreviewProps> = ({ channel }) => {
6161
const { chatClient } = useAppContext();

package/src/__tests__/offline-support/offline-feature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { BetterSqlite } from '../../test-utils/BetterSqlite';
4444

4545
/**
4646
* We are gonna use following custom UI components for preview and list.
47-
* If we use ChannelPreviewMessenger or ChannelPreviewLastMessage here, then changes
47+
* If we use ChannelPreviewView or ChannelPreviewLastMessage here, then changes
4848
* to those components might end up breaking tests for ChannelList, which will be quite painful
4949
* to debug.
5050
*/

package/src/components/ChannelList/ChannelList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
import { useChatContext } from '../../contexts/chatContext/ChatContext';
2929
import { SwipeRegistryProvider } from '../../contexts/swipeableContext/SwipeRegistryContext';
3030
import type { ChannelListEventListenerOptions } from '../../types/types';
31-
import { ChannelPreviewMessenger } from '../ChannelPreview/ChannelPreviewMessenger';
31+
import { ChannelPreviewView } from '../ChannelPreview/ChannelPreviewView';
3232
import { EmptyStateIndicator as EmptyStateIndicatorDefault } from '../Indicators/EmptyStateIndicator';
3333
import { LoadingErrorIndicator as LoadingErrorIndicatorDefault } from '../Indicators/LoadingErrorIndicator';
3434

@@ -282,7 +282,7 @@ export const ChannelList = (props: ChannelListProps) => {
282282
onRemovedFromChannel,
283283
onSelect,
284284
options = DEFAULT_OPTIONS,
285-
Preview = ChannelPreviewMessenger,
285+
Preview = ChannelPreviewView,
286286
getChannelActionItems,
287287
PreviewAvatar,
288288
PreviewMessage,

package/src/components/ChannelList/__tests__/ChannelList.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jest.mock('../../ChannelPreview/ChannelSwipableWrapper', () => ({
4343

4444
/**
4545
* We are gonna use following custom UI components for preview and list.
46-
* If we use ChannelPreviewMessenger or ChannelPreviewLastMessage here, then changes
46+
* If we use ChannelPreviewView or ChannelPreviewLastMessage here, then changes
4747
* to those components might end up breaking tests for ChannelList, which will be quite painful
4848
* to debug.
4949
*/

package/src/components/ChannelPreview/ChannelPreviewStatus.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
22
import { StyleSheet, Text } from 'react-native';
33

44
import { ChannelPreviewProps } from './ChannelPreview';
5-
import type { ChannelPreviewMessengerPropsWithContext } from './ChannelPreviewMessenger';
5+
import type { ChannelPreviewViewPropsWithContext } from './ChannelPreviewView';
66

77
import { useTheme } from '../../contexts/themeContext/ThemeContext';
88
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
@@ -11,7 +11,7 @@ import { primitives } from '../../theme';
1111
import { getDateString } from '../../utils/i18n/getDateString';
1212

1313
export type ChannelPreviewStatusProps = Pick<
14-
ChannelPreviewMessengerPropsWithContext,
14+
ChannelPreviewViewPropsWithContext,
1515
'formatLatestMessageDate' | 'lastMessage'
1616
> &
1717
Pick<ChannelPreviewProps, 'channel'>;

package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx renamed to package/src/components/ChannelPreview/ChannelPreviewView.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useStableCallback } from '../../hooks';
2020
import { primitives } from '../../theme';
2121
import { ChannelAvatar } from '../ui/Avatar/ChannelAvatar';
2222

23-
export type ChannelPreviewMessengerPropsWithContext = Pick<ChannelPreviewProps, 'channel'> &
23+
export type ChannelPreviewViewPropsWithContext = Pick<ChannelPreviewProps, 'channel'> &
2424
Pick<
2525
ChannelsContextValue,
2626
| 'maxUnreadCount'
@@ -50,7 +50,7 @@ export type ChannelPreviewMessengerPropsWithContext = Pick<ChannelPreviewProps,
5050
lastMessage?: LastMessageType;
5151
};
5252

53-
const ChannelPreviewMessengerWithContext = (props: ChannelPreviewMessengerPropsWithContext) => {
53+
const ChannelPreviewViewWithContext = (props: ChannelPreviewViewPropsWithContext) => {
5454
const {
5555
channel,
5656
formatLatestMessageDate,
@@ -146,20 +146,18 @@ const ChannelPreviewMessengerWithContext = (props: ChannelPreviewMessengerPropsW
146146
);
147147
};
148148

149-
export type ChannelPreviewMessengerProps = Partial<
150-
Omit<ChannelPreviewMessengerPropsWithContext, 'channel'>
151-
> &
152-
Pick<ChannelPreviewMessengerPropsWithContext, 'channel'>;
149+
export type ChannelPreviewViewProps = Partial<Omit<ChannelPreviewViewPropsWithContext, 'channel'>> &
150+
Pick<ChannelPreviewViewPropsWithContext, 'channel'>;
153151

154-
const MemoizedChannelPreviewMessengerWithContext = React.memo(
155-
ChannelPreviewMessengerWithContext,
156-
) as typeof ChannelPreviewMessengerWithContext;
152+
const MemoizedChannelPreviewViewWithContext = React.memo(
153+
ChannelPreviewViewWithContext,
154+
) as typeof ChannelPreviewViewWithContext;
157155

158156
/**
159157
* This UI component displays an individual preview item for each channel in a list. It also receives all props
160158
* from the ChannelPreview component.
161159
*/
162-
export const ChannelPreviewMessenger = (props: ChannelPreviewMessengerProps) => {
160+
export const ChannelPreviewView = (props: ChannelPreviewViewProps) => {
163161
const {
164162
forceUpdate,
165163
maxUnreadCount,
@@ -172,7 +170,7 @@ export const ChannelPreviewMessenger = (props: ChannelPreviewMessengerProps) =>
172170
mutedStatusPosition,
173171
} = useChannelsContext();
174172
return (
175-
<MemoizedChannelPreviewMessengerWithContext
173+
<MemoizedChannelPreviewViewWithContext
176174
{...{
177175
forceUpdate,
178176
maxUnreadCount,
@@ -189,7 +187,7 @@ export const ChannelPreviewMessenger = (props: ChannelPreviewMessengerProps) =>
189187
);
190188
};
191189

192-
ChannelPreviewMessenger.displayName = 'ChannelPreviewMessenger{channelPreview}';
190+
ChannelPreviewView.displayName = 'ChannelPreviewView{channelPreview}';
193191

194192
const useStyles = () => {
195193
const {

package/src/components/ChannelPreview/__tests__/ChannelPreviewMessenger.test.js renamed to package/src/components/ChannelPreview/__tests__/ChannelPreviewView.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import { generateMessage } from '../../../mock-builders/generator/message';
1111
import { generateUser } from '../../../mock-builders/generator/user';
1212
import { getTestClientWithUser } from '../../../mock-builders/mock';
1313
import { Chat } from '../../Chat/Chat';
14-
import { ChannelPreviewMessenger } from '../ChannelPreviewMessenger';
14+
import { ChannelPreviewView } from '../ChannelPreviewView';
1515

16-
describe('ChannelPreviewMessenger', () => {
16+
describe('ChannelPreviewView', () => {
1717
const clientUser = generateUser();
1818
let chatClient;
1919
let channel;
2020

2121
const getComponent = (props = {}) => (
2222
<Chat client={chatClient}>
23-
<ChannelPreviewMessenger
23+
<ChannelPreviewView
2424
channel={channel}
2525
client={chatClient}
2626
latestMessagePreview={{

package/src/components/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export * from './ChannelPreview/ChannelLastMessagePreview';
4848
export * from './ChannelPreview/ChannelMessagePreviewDeliveryStatus';
4949
export * from './ChannelPreview/ChannelPreview';
5050
export * from './ChannelPreview/ChannelPreviewMessage';
51-
export * from './ChannelPreview/ChannelPreviewMessenger';
51+
export * from './ChannelPreview/ChannelPreviewView';
5252
export * from './ChannelPreview/ChannelPreviewMutedStatus';
5353
export * from './ChannelPreview/ChannelLastMessagePreview';
5454
export * from './ChannelPreview/ChannelPreviewStatus';

package/src/contexts/channelsContext/ChannelsContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import type { ChannelDetailsBottomSheetProps } from '../../components/ChannelPre
1212
import { ChannelLastMessagePreviewProps } from '../../components/ChannelPreview/ChannelLastMessagePreview';
1313
import { ChannelMessagePreviewDeliveryStatusProps } from '../../components/ChannelPreview/ChannelMessagePreviewDeliveryStatus';
1414
import { ChannelPreviewMessageProps } from '../../components/ChannelPreview/ChannelPreviewMessage';
15-
import type { ChannelPreviewMessengerProps } from '../../components/ChannelPreview/ChannelPreviewMessenger';
1615
import type { ChannelPreviewStatusProps } from '../../components/ChannelPreview/ChannelPreviewStatus';
1716
import type { ChannelPreviewTitleProps } from '../../components/ChannelPreview/ChannelPreviewTitle';
1817
import { ChannelPreviewTypingIndicatorProps } from '../../components/ChannelPreview/ChannelPreviewTypingIndicator';
1918
import type { ChannelPreviewUnreadCountProps } from '../../components/ChannelPreview/ChannelPreviewUnreadCount';
19+
import type { ChannelPreviewViewProps } from '../../components/ChannelPreview/ChannelPreviewView';
2020
import type { EmptyStateProps } from '../../components/Indicators/EmptyStateIndicator';
2121
import type { LoadingErrorProps } from '../../components/Indicators/LoadingErrorIndicator';
2222
import type { LoadingProps } from '../../components/Indicators/LoadingIndicator';
@@ -124,9 +124,9 @@ export type ChannelsContextValue = {
124124
/**
125125
* Custom UI component to display individual channel list items
126126
*
127-
* Default: [ChannelPreviewMessenger](https://getstream.io/chat/docs/sdk/reactnative/ui-components/channel-preview-messenger/)
127+
* Default: [ChannelPreviewView](https://getstream.io/chat/docs/sdk/reactnative/ui-components/channel-preview-view/)
128128
*/
129-
Preview: React.ComponentType<ChannelPreviewMessengerProps>;
129+
Preview: React.ComponentType<ChannelPreviewViewProps>;
130130
/**
131131
* Triggered when the channel list is refreshing, displays a loading spinner at the top of the list
132132
*/

0 commit comments

Comments
 (0)