Page MenuHomePhabricator

D6598.id22083.diff
No OneTemporary

D6598.id22083.diff

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
@@ -29,7 +29,6 @@
threadIsPending,
threadMembersWithoutAddedAshoat,
} from 'lib/shared/thread-utils';
-import { firstLine } from 'lib/utils/string-utils';
import KeyboardAvoidingView from '../components/keyboard-avoiding-view.react';
import SWMansionIcon from '../components/swmansion-icon.react';
@@ -64,6 +63,7 @@
import ThreadSettings from './settings/thread-settings.react';
import ThreadScreenPruner from './thread-screen-pruner.react';
import ThreadSettingsButton from './thread-settings-button.react';
+import ThreadSettingsHeaderTitle from './thread-settings-header-title.react';
const unboundStyles = {
keyboardAvoidingView: {
@@ -240,7 +240,13 @@
headerBackTitleVisible: false,
};
const threadSettingsOptions = ({ route }) => ({
- headerTitle: firstLine(route.params.threadInfo.uiName),
+ // eslint-disable-next-line react/display-name
+ headerTitle: props => (
+ <ThreadSettingsHeaderTitle
+ threadInfo={route.params.threadInfo}
+ {...props}
+ />
+ ),
headerBackTitleVisible: false,
});
const deleteThreadOptions = {
diff --git a/native/chat/thread-settings-header-title.react.js b/native/chat/thread-settings-header-title.react.js
new file mode 100644
--- /dev/null
+++ b/native/chat/thread-settings-header-title.react.js
@@ -0,0 +1,27 @@
+// @flow
+
+import {
+ HeaderTitle,
+ type HeaderTitleInputProps,
+} from '@react-navigation/elements';
+import * as React from 'react';
+
+import type { ThreadInfo } from 'lib/types/thread-types';
+import { useResolvedThreadInfo } from 'lib/utils/entity-helpers';
+import { firstLine } from 'lib/utils/string-utils';
+
+type Props = {
+ +threadInfo: ThreadInfo,
+ ...HeaderTitleInputProps,
+};
+function ThreadSettingsHeaderTitle(props: Props): React.Node {
+ const { threadInfo, ...rest } = props;
+ const { uiName } = useResolvedThreadInfo(threadInfo);
+ return <HeaderTitle {...rest}>{firstLine(uiName)}</HeaderTitle>;
+}
+
+const MemoizedThreadSettingsHeaderTitle: React.ComponentType<Props> = React.memo<Props>(
+ ThreadSettingsHeaderTitle,
+);
+
+export default MemoizedThreadSettingsHeaderTitle;

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 3:47 AM (17 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2683443
Default Alt Text
D6598.id22083.diff (2 KB)

Event Timeline