From 6bd351ed413a4ecf0b598c75743018c28eb57441 Mon Sep 17 00:00:00 2001 From: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com> Date: Fri, 15 Oct 2021 13:23:27 +0200 Subject: [PATCH] Fix channel transition from narrow (#73) --- packages/react-chat/src/components/Chat/ChatBody.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-chat/src/components/Chat/ChatBody.tsx b/packages/react-chat/src/components/Chat/ChatBody.tsx index d2e6cef1..a9d1ecfe 100644 --- a/packages/react-chat/src/components/Chat/ChatBody.tsx +++ b/packages/react-chat/src/components/Chat/ChatBody.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo, useState } from "react"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; import styled from "styled-components"; import { useNarrow } from "../../contexts/narrowProvider"; @@ -71,6 +71,13 @@ export function ChatBody({ setShowMembersList(!showMembersList); }, [showMembersList]); + useEffect(() => { + if (!narrow) { + setShowChannelsList(false); + setShowMembersList(false); + } + }, [narrow]); + return (