Skip to content

Commit bcf6866

Browse files
authored
feat: component renaming (#3502)
## 🎯 Goal This PR standardizes several legacy UI component names to a cleaner and more consistent naming scheme. It also aligns the related public API, theme keys, tests, and sample usages with those names. It also adds a few lightweight message row customization slots so consumers can extend layout without fully replacing the default message components. - Renamed `MessageSimple` -> `MessageItemView` - Renamed `MessageAvatar` -> `MessageAuthor` - Renamed `MessageInput` -> `MessageComposer` - Renamed `ChannelListMessenger` -> `ChannelListView` - Renamed `ChannelPreviewMessenger` -> `ChannelPreviewView` - Added `MessageSpacer` - Added `MessageContentTopView` - Added `MessageContentBottomView` - Added `MessageContentLeadingView` - Added `MessageContentTrailingView` ## 🛠 Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent 1ff30ca commit bcf6866

File tree

125 files changed

+838
-624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+838
-624
lines changed

examples/ExpoMessaging/app/channel/[cid]/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react';
22
import type { Channel as StreamChatChannel } from 'stream-chat';
33
import {
44
Channel,
5-
MessageInput,
5+
MessageComposer,
66
useChatContext,
77
ThreadContextValue,
88
MessageList,
@@ -84,7 +84,7 @@ export default function ChannelScreen() {
8484
router.push(`/channel/${channel.cid}/thread/${thread?.cid ?? ''}`);
8585
}}
8686
/>
87-
<MessageInput InputButtons={InputButtons} />
87+
<MessageComposer InputButtons={InputButtons} />
8888
</Channel>
8989
</View>
9090
);

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/components/NewDirectMessagingSendButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const SendButtonWithContext = (props: NewDirectMessagingSendButtonPropsWithConte
3030
const {
3131
theme: {
3232
colors: { accent_blue, grey_gainsboro },
33-
messageInput: { sendButton },
33+
messageComposer: { sendButton },
3434
},
3535
} = useTheme();
3636

@@ -89,7 +89,7 @@ const MemoizedNewDirectMessagingSendButton = React.memo(
8989
export type SendButtonProps = Partial<NewDirectMessagingSendButtonPropsWithContext>;
9090

9191
/**
92-
* UI Component for send button in MessageInput component.
92+
* UI Component for send button in MessageComposer component.
9393
*/
9494
export const NewDirectMessagingSendButton = (props: SendButtonProps) => {
9595
const { chatClient } = useAppContext();

examples/SampleApp/src/screens/ChannelScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RouteProp, useFocusEffect, useNavigation } from '@react-navigation/nati
44
import {
55
AlsoSentToChannelHeaderPressPayload,
66
Channel,
7-
MessageInput,
7+
MessageComposer,
88
MessageList,
99
MessageFlashList,
1010
ThreadContextValue,
@@ -301,7 +301,7 @@ export const ChannelScreen: React.FC<ChannelScreenProps> = ({
301301
/>
302302
)}
303303
<AITypingIndicatorView channel={channel} />
304-
<MessageInput />
304+
<MessageComposer />
305305
{modalVisible && (
306306
<MessageInfoBottomSheet
307307
visible={modalVisible}

examples/SampleApp/src/screens/NewDirectMessagingScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Platform, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'r
33
import { SafeAreaView } from 'react-native-safe-area-context';
44
import {
55
Channel,
6-
MessageInput,
6+
MessageComposer,
77
MessageList,
88
User,
99
UserAdd,
@@ -340,7 +340,7 @@ export const NewDirectMessagingScreen: React.FC<NewDirectMessagingScreenProps> =
340340
{results && results.length >= 0 && !focusOnSearchInput && focusOnMessageInput && (
341341
<MessageList />
342342
)}
343-
<MessageInput />
343+
<MessageComposer />
344344
</Channel>
345345
</SafeAreaView>
346346
);

examples/SampleApp/src/screens/SharedGroupsScreen.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
33
import { NavigationProp, RouteProp, useNavigation } from '@react-navigation/native';
44
import {
55
ChannelList,
6-
ChannelListMessenger,
7-
ChannelListMessengerProps,
8-
ChannelPreviewMessengerProps,
6+
ChannelListView,
7+
ChannelListViewProps,
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();
@@ -150,7 +150,7 @@ const EmptyListComponent = () => {
150150
);
151151
};
152152

153-
type ListComponentProps = ChannelListMessengerProps;
153+
type ListComponentProps = ChannelListViewProps;
154154

155155
// If the length of channels is 1, which means we only got 1:1-distinct channel,
156156
// And we don't want to show 1:1-distinct channel in this list.
@@ -161,7 +161,7 @@ const ListComponent: React.FC<ListComponentProps> = (props) => {
161161
return <EmptyListComponent />;
162162
}
163163

164-
return <ChannelListMessenger {...props} />;
164+
return <ChannelListView {...props} />;
165165
};
166166

167167
type SharedGroupsScreenRouteProp = RouteProp<StackNavigatorParamList, 'SharedGroupsScreen'>;

examples/TypeScriptMessaging/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
Channel,
1717
ChannelList,
1818
Chat,
19-
MessageInput,
19+
MessageComposer,
2020
MessageList,
2121
OverlayProvider,
2222
SqliteClient,
@@ -132,7 +132,7 @@ const ChannelScreen: React.FC<ChannelScreenProps> = ({ navigation }) => {
132132
}
133133
}}
134134
/>
135-
<MessageInput />
135+
<MessageComposer />
136136
</View>
137137
</Channel>
138138
</SafeAreaView>

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/AITypingIndicatorView/AITypingIndicatorView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const AITypingIndicatorView = ({
3434
) : null;
3535
};
3636

37-
AITypingIndicatorView.displayName = 'AITypingIndicatorView{messageSimple{content}}';
37+
AITypingIndicatorView.displayName = 'AITypingIndicatorView{messageItemView{content}}';
3838

3939
const useStyles = () => {
4040
const {

package/src/components/Attachment/Audio/AudioAttachment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
187187
rightContainer,
188188
},
189189
semantics,
190-
messageInput: {
190+
messageComposer: {
191191
fileAttachmentUploadPreview: { filenameText },
192192
},
193193
},
@@ -354,4 +354,4 @@ const useStyles = () => {
354354
}, [semantics]);
355355
};
356356

357-
AudioAttachment.displayName = 'AudioAttachment{messageInput{audioAttachment}}';
357+
AudioAttachment.displayName = 'AudioAttachment{messageComposer{audioAttachment}}';

0 commit comments

Comments
 (0)