diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js
--- a/native/chat/chat.react.js
+++ b/native/chat/chat.react.js
@@ -192,33 +192,43 @@
headerBackTitleVisible: false,
headerStyle: unboundStyles.threadListHeaderStyle,
});
-const messageListOptions = ({ navigation, route }) => ({
- // This is a render prop, not a component
- // eslint-disable-next-line react/display-name
- headerTitle: () => (
-
- ),
- headerTitleContainerStyle: {
- marginHorizontal: Platform.select({ ios: 80, default: 0 }),
- flex: 1,
- },
- headerRight:
- Platform.OS === 'android' && !threadIsPending(route.params.threadInfo.id)
- ? // This is a render prop, not a component
- // eslint-disable-next-line react/display-name
- () => (
-
- )
- : undefined,
- headerBackTitleVisible: false,
-});
+
+const messageListOptions = ({ navigation, route }) => {
+ const isSearchEmpty =
+ route.params.searching && route.params.threadInfo.members.length === 2;
+
+ const areSettingsEnabled =
+ !threadIsPending(route.params.threadInfo.id) && !isSearchEmpty;
+
+ return {
+ // This is a render prop, not a component
+ // eslint-disable-next-line react/display-name
+ headerTitle: () => (
+
+ ),
+ headerTitleContainerStyle: {
+ marginHorizontal: Platform.select({ ios: 80, default: 0 }),
+ flex: 1,
+ },
+ headerRight:
+ Platform.OS === 'android' && areSettingsEnabled
+ ? // This is a render prop, not a component
+ // eslint-disable-next-line react/display-name
+ () => (
+
+ )
+ : undefined,
+ headerBackTitleVisible: false,
+ };
+};
const composeThreadOptions = {
headerTitle: 'Compose chat',
headerBackTitleVisible: false,
diff --git a/native/chat/message-list-header-title.react.js b/native/chat/message-list-header-title.react.js
--- a/native/chat/message-list-header-title.react.js
+++ b/native/chat/message-list-header-title.react.js
@@ -5,7 +5,6 @@
import { View, Platform } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
-import { threadIsPending } from 'lib/shared/thread-utils';
import type { ThreadInfo } from 'lib/types/thread-types';
import { firstLine } from 'lib/utils/string-utils';
@@ -16,8 +15,9 @@
type BaseProps = {
+threadInfo: ThreadInfo,
- +searching: boolean | void,
+navigate: $PropertyType, 'navigate'>,
+ +isSearchEmpty: boolean | void,
+ +areSettingsEnabled: boolean | void,
};
type Props = {
...BaseProps,
@@ -25,12 +25,8 @@
};
class MessageListHeaderTitle extends React.PureComponent {
render() {
- const isSearchEmpty =
- this.props.searching && this.props.threadInfo.members.length === 2;
let icon, fakeIcon;
- const areSettingsDisabled =
- threadIsPending(this.props.threadInfo.id) || isSearchEmpty;
- if (Platform.OS === 'ios' && !areSettingsDisabled) {
+ if (Platform.OS === 'ios' && this.props.areSettingsEnabled) {
icon = (
);
}
- const title = isSearchEmpty ? 'New Message' : this.props.threadInfo.uiName;
+
+ const title = this.props.isSearchEmpty
+ ? 'New Message'
+ : this.props.threadInfo.uiName;
+
return (