Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353611
D5219.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5219.diff
View Options
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
@@ -21,7 +21,10 @@
import { useSelector } from 'react-redux';
import { isLoggedIn } from 'lib/selectors/user-selectors';
-import { threadIsPending } from 'lib/shared/thread-utils';
+import {
+ threadIsPending,
+ threadMembersWithoutAddedAshoat,
+} from 'lib/shared/thread-utils';
import { firstLine } from 'lib/utils/string-utils';
import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';
@@ -192,33 +195,44 @@
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: () => (
- <MessageListHeaderTitle
- threadInfo={route.params.threadInfo}
- searching={route.params.searching}
- navigate={navigation.navigate}
- />
- ),
- 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
- () => (
- <ThreadSettingsButton
- threadInfo={route.params.threadInfo}
- navigate={navigation.navigate}
- />
- )
- : undefined,
- headerBackTitleVisible: false,
-});
+
+const messageListOptions = ({ navigation, route }) => {
+ const isSearchEmpty =
+ !!route.params.searching &&
+ threadMembersWithoutAddedAshoat(route.params.threadInfo).length === 1;
+
+ 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: () => (
+ <MessageListHeaderTitle
+ threadInfo={route.params.threadInfo}
+ navigate={navigation.navigate}
+ areSettingsEnabled={areSettingsEnabled}
+ isSearchEmpty={isSearchEmpty}
+ />
+ ),
+ 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
+ () => (
+ <ThreadSettingsButton
+ threadInfo={route.params.threadInfo}
+ navigate={navigation.navigate}
+ />
+ )
+ : 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,10 +5,6 @@
import { View, Platform } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
-import {
- threadIsPending,
- threadMembersWithoutAddedAshoat,
-} from 'lib/shared/thread-utils';
import type { ThreadInfo } from 'lib/types/thread-types';
import { firstLine } from 'lib/utils/string-utils';
@@ -19,8 +15,9 @@
type BaseProps = {
+threadInfo: ThreadInfo,
- +searching: boolean | void,
+navigate: $PropertyType<ChatNavigationProp<'MessageList'>, 'navigate'>,
+ +isSearchEmpty: boolean,
+ +areSettingsEnabled: boolean,
};
type Props = {
...BaseProps,
@@ -28,13 +25,8 @@
};
class MessageListHeaderTitle extends React.PureComponent<Props> {
render() {
- const isSearchEmpty =
- this.props.searching &&
- threadMembersWithoutAddedAshoat(this.props.threadInfo).length === 1;
let icon, fakeIcon;
- const areSettingsDisabled =
- threadIsPending(this.props.threadInfo.id) || isSearchEmpty;
- if (Platform.OS === 'ios' && !areSettingsDisabled) {
+ if (Platform.OS === 'ios' && this.props.areSettingsEnabled) {
icon = (
<Icon
name="ios-arrow-forward"
@@ -50,13 +42,17 @@
/>
);
}
- const title = isSearchEmpty ? 'New Message' : this.props.threadInfo.uiName;
+
+ const title = this.props.isSearchEmpty
+ ? 'New Message'
+ : this.props.threadInfo.uiName;
+
return (
<Button
onPress={this.onPress}
style={this.props.styles.button}
androidBorderlessRipple={true}
- disabled={areSettingsDisabled}
+ disabled={!this.props.areSettingsEnabled}
>
<View style={this.props.styles.container}>
{fakeIcon}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 10:30 AM (22 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575027
Default Alt Text
D5219.diff (4 KB)
Attached To
Mode
D5219: [native] Unify thread settings accessibility
Attached
Detach File
Event Timeline
Log In to Comment