Page MenuHomePhabricator

D6553.id21934.diff
No OneTemporary

D6553.id21934.diff

diff --git a/native/chat/chat-context-provider.react.js b/native/chat/chat-context-provider.react.js
--- a/native/chat/chat-context-provider.react.js
+++ b/native/chat/chat-context-provider.react.js
@@ -126,11 +126,6 @@
sidebarAnimationType,
setSidebarAnimationType,
] = React.useState<SidebarAnimationType>('move_source_message');
- const setSidebarAnimationTypeCallback = React.useCallback(
- (animationType: SidebarAnimationType) =>
- setSidebarAnimationType(animationType),
- [],
- );
const contextValue = React.useMemo(
() => ({
@@ -141,14 +136,13 @@
deleteChatInputBarHeight,
chatInputBarHeights: chatInputBarHeights.current,
sidebarAnimationType,
- setSidebarAnimationType: setSidebarAnimationTypeCallback,
+ setSidebarAnimationType,
}),
[
currentTransitionSidebarSourceID,
deleteChatInputBarHeight,
registerMeasurer,
setChatInputBarHeight,
- setSidebarAnimationTypeCallback,
sidebarAnimationType,
],
);
diff --git a/native/chat/utils.js b/native/chat/utils.js
--- a/native/chat/utils.js
+++ b/native/chat/utils.js
@@ -219,31 +219,25 @@
const viewerID = useSelector(
state => state.currentUserInfo && state.currentUserInfo.id,
);
- const sidebarThreadInfo = React.useMemo(() => {
- return getSidebarThreadInfo(sourceMessage, viewerID);
- }, [sourceMessage, viewerID]);
+ const sidebarThreadInfo = React.useMemo(
+ () => getSidebarThreadInfo(sourceMessage, viewerID),
+ [sourceMessage, viewerID],
+ );
const currentInputBarHeight =
chatInputBarHeights.get(sourceMessage.threadInfo.id) ?? 0;
const keyboardState = React.useContext(KeyboardContext);
- const viewerIsSidebarMember = viewerIsMember(sidebarThreadInfo);
+
+ const newSidebarAnimationType =
+ !currentInputBarHeight ||
+ !targetInputBarHeight ||
+ keyboardState?.keyboardShowing ||
+ !viewerIsMember(sidebarThreadInfo)
+ ? 'fade_source_message'
+ : 'move_source_message';
React.useEffect(() => {
- const newSidebarAnimationType =
- !currentInputBarHeight ||
- !targetInputBarHeight ||
- keyboardState?.keyboardShowing ||
- !viewerIsSidebarMember
- ? 'fade_source_message'
- : 'move_source_message';
setSidebarAnimationType(newSidebarAnimationType);
- }, [
- currentInputBarHeight,
- keyboardState?.keyboardShowing,
- setSidebarAnimationType,
- sidebarThreadInfo,
- targetInputBarHeight,
- viewerIsSidebarMember,
- ]);
+ }, [setSidebarAnimationType, newSidebarAnimationType]);
const {
position: targetPosition,

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 6:24 PM (18 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2688688
Default Alt Text
D6553.id21934.diff (2 KB)

Event Timeline