Page MenuHomePhabricator

D5082.id16977.diff
No OneTemporary

D5082.id16977.diff

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,27 @@
'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) {
+ 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: threadInfo });
+ }, [setParams, threadInfo]);
React.useEffect(() => {
if (!isSearching) {
return;
@@ -278,7 +293,6 @@
return () => inputState.unregisterSendCallback(hideSearch);
}, [hideSearch, inputState, isSearching]);
- const { setParams } = props.navigation;
React.useEffect(() => {
setParams({ threadInfo });
}, [setParams, threadInfo]);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 15, 11:55 PM (20 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495819
Default Alt Text
D5082.id16977.diff (2 KB)

Event Timeline