Page MenuHomePhabricator

D7777.id26719.diff
No OneTemporary

D7777.id26719.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
@@ -72,6 +72,7 @@
} from '../navigation/route-names.js';
import MessageSearch from '../search/message-search.react.js';
import SearchHeader from '../search/search-header.react.js';
+import SearchMessagesButton from '../search/search-messages-button.react.js';
import { useColors, useStyles } from '../themes/colors.js';
const unboundStyles = {
@@ -210,6 +211,8 @@
return <ChatHeader {...castProps} />;
};
+const headerRightStyle = { flexDirection: 'row' };
+
const messageListOptions = ({ navigation, route }) => {
const isSearchEmpty =
!!route.params.searching &&
@@ -234,10 +237,16 @@
? // This is a render prop, not a component
// eslint-disable-next-line react/display-name
() => (
- <ThreadSettingsButton
- threadInfo={route.params.threadInfo}
- navigate={navigation.navigate}
- />
+ <View style={headerRightStyle}>
+ <SearchMessagesButton
+ threadInfo={route.params.threadInfo}
+ navigate={navigation.navigate}
+ />
+ <ThreadSettingsButton
+ threadInfo={route.params.threadInfo}
+ navigate={navigation.navigate}
+ />
+ </View>
)
: undefined,
headerBackTitleVisible: false,
diff --git a/native/search/search-messages-button.react.js b/native/search/search-messages-button.react.js
new file mode 100644
--- /dev/null
+++ b/native/search/search-messages-button.react.js
@@ -0,0 +1,44 @@
+// @flow
+
+import * as React from 'react';
+
+import { type ThreadInfo } from 'lib/types/thread-types.js';
+
+import type { ChatNavigationProp } from '../chat/chat.react.js';
+import Button from '../components/button.react.js';
+import SWMansionIcon from '../components/swmansion-icon.react.js';
+import { MessageSearchRouteName } from '../navigation/route-names.js';
+import { useStyles } from '../themes/colors.js';
+
+type Props = {
+ +threadInfo: ThreadInfo,
+ +navigate: $PropertyType<ChatNavigationProp<'MessageList'>, 'navigate'>,
+};
+
+function SearchMessagesButton(props: Props): React.Node {
+ const { threadInfo, navigate } = props;
+ const styles = useStyles(unboundStyles);
+
+ const onPress = React.useCallback(() => {
+ navigate<'MessageSearch'>({
+ name: MessageSearchRouteName,
+ params: { threadInfo },
+ key: `${MessageSearchRouteName}${threadInfo.id}`,
+ });
+ }, [navigate, threadInfo]);
+
+ return (
+ <Button onPress={onPress} androidBorderlessRipple={true}>
+ <SWMansionIcon name="search" size={24} style={styles.button} />
+ </Button>
+ );
+}
+
+const unboundStyles = {
+ button: {
+ color: 'panelForegroundLabel',
+ paddingHorizontal: 10,
+ },
+};
+
+export default SearchMessagesButton;

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 6:40 PM (20 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585324
Default Alt Text
D7777.id26719.diff (2 KB)

Event Timeline