Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3246510
D5082.id16984.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
D5082.id16984.diff
View Options
diff --git a/native/chat/message-list-container.react.js b/native/chat/message-list-container.react.js
--- a/native/chat/message-list-container.react.js
+++ b/native/chat/message-list-container.react.js
@@ -1,5 +1,6 @@
// @flow
+import { useNavigationState } from '@react-navigation/native';
import invariant from 'invariant';
import * as React from 'react';
import { View } from 'react-native';
@@ -29,6 +30,7 @@
type OverlayContextType,
} from '../navigation/overlay-context';
import type { NavigationRoute } from '../navigation/route-names';
+import { ThreadSettingsRouteName } from '../navigation/route-names';
import { useSelector } from '../redux/redux-utils';
import { type Colors, useColors, useStyles } from '../themes/colors';
import type { ChatMessageItemWithHeight } from '../types/chat-types';
@@ -262,14 +264,28 @@
'threadInfo must be specified in messageListContainer',
);
+ const { setParams } = props.navigation;
+ const navigationStack = useNavigationState(state => state.routes);
+ React.useEffect(() => {
+ const topRoute = navigationStack[navigationStack.length - 1];
+ if (topRoute?.name !== ThreadSettingsRouteName) {
+ return;
+ }
+ setBaseThreadInfo(threadInfo);
+ if (isSearching) {
+ setParams({
+ searching: false,
+ threadInfo,
+ });
+ }
+ }, [isSearching, navigationStack, setParams, threadInfo]);
+
const inputState = React.useContext(InputStateContext);
invariant(inputState, 'inputState should be set in MessageListContainer');
const hideSearch = React.useCallback(() => {
setBaseThreadInfo(threadInfo);
- props.navigation.setParams({
- searching: false,
- });
- }, [props.navigation, threadInfo]);
+ setParams({ searching: false, threadInfo });
+ }, [setParams, threadInfo]);
React.useEffect(() => {
if (!isSearching) {
return;
@@ -278,7 +294,6 @@
return () => inputState.unregisterSendCallback(hideSearch);
}, [hideSearch, inputState, isSearching]);
- const { setParams } = props.navigation;
React.useEffect(() => {
setParams({ threadInfo });
}, [setParams, threadInfo]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 12:16 AM (20 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495858
Default Alt Text
D5082.id16984.diff (2 KB)
Attached To
Mode
D5082: [native] base on existing thread info when there is any and user is not searching
Attached
Detach File
Event Timeline
Log In to Comment