Skip to content

Commit cb9ffaa

Browse files
committed
small fixes
1 parent f7eb432 commit cb9ffaa

3 files changed

Lines changed: 10 additions & 20 deletions

File tree

package/src/components/ChannelDetailsScreen/ChannelDetailsScreen.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ import { useCreateOwnCapabilitiesContext } from '../Channel/hooks/useCreateOwnCa
1919
export type ChannelDetailsScreenProps = {
2020
channel: Channel;
2121
/**
22-
* Fired when the user taps the add-members button in the all-members bottom sheet.
23-
* The button is shown whenever the current user has the `update-channel-members`
24-
* capability; until this callback is provided the press is a no-op.
22+
* Fired when the user taps the "add members" button, by default it opens the add members bottom sheet. Only visible if the current user has the `update-channel-members` capability.
2523
*/
2624
onAddMembersPress?: () => void;
25+
/**
26+
* Fired when the back button is pressed on the channel details header.
27+
*/
2728
onBack?: () => void;
28-
/** Fired after the channel is no longer available to the current user (delete or leave). */
29+
/** Fired after the channel is no longer available to the current user (delete or leave actions). */
2930
onChannelDismiss?: () => void;
3031
/**
31-
* Override for the default "View all" members behavior. When provided, the member
32-
* section calls this callback instead of opening the built-in bottom-sheet — use it
33-
* to navigate to a dedicated members screen instead.
32+
* Fired when the user taps the "view all members" button, by default it opens the members bottom sheet.
3433
*/
3534
onViewAllMembersPress?: () => void;
3635
};

package/src/components/ChannelDetailsScreen/components/ChannelAddMembers.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ViewStyle,
1313
} from 'react-native';
1414

15-
import type { Channel, UserResponse } from 'stream-chat';
15+
import type { UserResponse } from 'stream-chat';
1616

1717
import { useChannelDetailsContext } from '../../../contexts/channelDetailsContext/channelDetailsContext';
1818
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
@@ -33,11 +33,6 @@ export type ChannelAddMembersProps = {
3333
* selected user ids when committing the add).
3434
*/
3535
onSelectionChange: (selectedUsers: UserResponse[]) => void;
36-
/**
37-
* Optional channel override. Defaults to `useChannelDetailsContext().channel`.
38-
* Used to filter out existing channel members from the result list.
39-
*/
40-
channel?: Channel;
4136
};
4237

4338
const keyExtractor = (user: UserResponse) => user.id;
@@ -180,12 +175,8 @@ const ChannelAddMembersEmptyState = ({
180175
);
181176
};
182177

183-
export const ChannelAddMembers = ({
184-
channel: channelProp,
185-
onSelectionChange,
186-
}: ChannelAddMembersProps) => {
187-
const { channel: channelFromContext } = useChannelDetailsContext();
188-
const channel = channelProp ?? channelFromContext;
178+
export const ChannelAddMembers = ({ onSelectionChange }: ChannelAddMembersProps) => {
179+
const { channel } = useChannelDetailsContext();
189180
const { t } = useTranslationContext();
190181
const {
191182
theme: {

package/src/components/ChannelDetailsScreen/components/ChannelDetailsMemberSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const ChannelDetailsMemberSection = () => {
257257
</Pressable>
258258
</View>
259259
</View>
260-
<ChannelAddMembers channel={channel} onSelectionChange={handleAddMembersSelectionChange} />
260+
<ChannelAddMembers onSelectionChange={handleAddMembersSelectionChange} />
261261
</BottomSheetModal>
262262
</View>
263263
);

0 commit comments

Comments
 (0)