Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: open a thread by id. #2588

Closed
MatheoJaouen opened this issue Jul 8, 2024 · 1 comment
Closed

Feature request: open a thread by id. #2588

MatheoJaouen opened this issue Jul 8, 2024 · 1 comment

Comments

@MatheoJaouen
Copy link

MatheoJaouen commented Jul 8, 2024

Motivation

Possibility to open/get a thread by id (or by parent message id) that we can pass to the thread property of the Channel component.
In order to open a thread in an independent screen or from a (push) notification or from anywhere else.

The thread property of the Channel component takes a MessageType declared by the react-native api.
While the api provide a different object Type for the getMessage or client.getThread (a MessageResponse if I recall correctly).
https://getstream.io/chat/docs/react-native/threads/?language=javascript#get-thread-by-id

thread: MessageType<StreamChatGenerics> | null;

The channel property on his side matches the api type so we can fetch it independently unlike the thread prop.

The only way to open a thread currently seems to be via the onThreadSelect prop of the MessageList.

Proposed solution

Acceptance Criteria
Open a thread from id (or parent message id).

As code example, I can get the channel but I'm not able to open the thread without passing the entire object obtained by a previous

export const ThreadViewerScreen: React.FC<NativeStackScreenProps<AppStackParamList, ScreenName.Thread>> = (props) => {
    const { params } = props.route;
    
    const { thread } = params; // I would need to pass only the id of the thread/message & fetch it/get it another way, in order for instance to open a thread from notification

    const { channel } = useChatStoreValues(); // channel is a Channel from stream-chat which is ok, I can get it by id from the api
    
  

	
    if (!channel) {
        return null;
    }

    return (
        <SafeAreaView>
            <ChatLoadingAndErrorView>
                <Channel
                    Input={CustomMessageInput}
                    channel={channel}
                    thread={thread}
                    allowThreadMessagesInChannel
                    threadList
                >
                    <Thread />
                </Channel>
            </ChatLoadingAndErrorView>
        </SafeAreaView>
    );
};
@MatheoJaouen MatheoJaouen changed the title getThread or message as MessageType from id to feed the thread property of the Channel component. Open a thread by id. Jul 8, 2024
@MatheoJaouen MatheoJaouen changed the title Open a thread by id. Feature request: open a thread by id. Jul 22, 2024
@khushal87
Copy link
Member

Copy of #2579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants