Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3506860
D6553.id21934.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6553.id21934.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6553: [native] Cleanup of sidebar animation code
Attached
Detach File
Event Timeline
Log In to Comment