stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

Missing 'ChannelListTeamProps' in stream-chat-react

Open gozanohesron opened this issue 5 years ago • 15 comments

In typescript, I am getting this error '"stream-chat-react"' has no exported member named 'ChannelListTeamProps'. Did you mean 'ChannelSearchProps'?

gozanohesron avatar Nov 03 '21 16:11 gozanohesron

Hello @gozanohesron, ChannelListTeam is a deprecated and removed component, therefore its props type no longer exists. Feel free to use ChannelListMessengerProps instead, as this pertains to the default List prop on the ChannelList component.

DanC5 avatar Nov 03 '21 16:11 DanC5

I'm going to close as this should fix your problem, but I'll continue to receive notifications on this issue if you have further questions, thanks!

DanC5 avatar Nov 03 '21 16:11 DanC5

@DanC5 can you update the demo code as it is still using said code? I am trying to study the demo code but I am having problem with that specific line. After putting the component you mentioned, I got new error pertaining to the children property

gozanohesron avatar Nov 03 '21 16:11 gozanohesron

Which demo are you referring to?

DanC5 avatar Nov 03 '21 16:11 DanC5

@DanC5 this one

https://github.com/GetStream/website-react-examples/tree/master/social-messenger

gozanohesron avatar Nov 03 '21 16:11 gozanohesron

Oh I see, social-messaging-ts in the website examples repo. I'll push that change up right now

DanC5 avatar Nov 03 '21 16:11 DanC5

@DanC5 yes yes, the TS version of that app. I am getting errors for that

gozanohesron avatar Nov 03 '21 16:11 gozanohesron

Just updated, https://github.com/GetStream/website-react-examples/blob/master/social-messenger-ts/src/components/MessagingChannelList/MessagingChannelList.tsx#L22.

Are you wrapping the type in React.FC like in the example? https://github.com/GetStream/website-react-examples/blob/master/social-messenger-ts/src/components/MessagingChannelList/MessagingChannelList.tsx#L26

You need this so TypeScript knows the component will render children. If you're not using React.FC then you can wrap the type in PropsWithChildren, imported from React.

PropsWithChildren<ChannelListMessengerProps>

DanC5 avatar Nov 03 '21 16:11 DanC5

@DanC5 I am just following the demo code as it is. I'm just studying it how to implement on our own app

gozanohesron avatar Nov 03 '21 16:11 gozanohesron

Hi @DanC5 would you mind helping me, I am getting last two errors with the ff files image image

gozanohesron avatar Nov 03 '21 17:11 gozanohesron

or perhaps should I report this on the example repository?

gozanohesron avatar Nov 03 '21 17:11 gozanohesron

For the second one, you're likely on a newer version of the library than is powering that example. The latestMessage prop on the Preview UI component can now be a React element, whereas it used to only be a string. This is to allow for message translation in the channel preview text. If you're doing something like this...

type Props = ChannelPreviewUIComponentProps & {
  channel: Channel;
  setIsCreating: React.Dispatch<React.SetStateAction<boolean>>;
  latestMessage?: string;
  setActiveChannel?: ChatContextValue['setActiveChannel'];
};

Remove the latestMessage?: string type and let me know if that fixes the second one

DanC5 avatar Nov 03 '21 17:11 DanC5

@DanC5 it did fix the issue for the second one

gozanohesron avatar Nov 03 '21 17:11 gozanohesron

For the first, in the overrideSubmitHandler function, change the type on the message param from...

{
    attachments: Attachment[];
    mentioned_users: UserResponse[];
    text: string;
    parent?: StreamMessage;
  }

to

MessageToSend, which you'll need to import from the library

DanC5 avatar Nov 03 '21 17:11 DanC5

@DanC5 thank you very much for the assistance

gozanohesron avatar Nov 03 '21 17:11 gozanohesron