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 ; }; +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 () => ( - + + + + ) : 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, '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 ( + + ); +} + +const unboundStyles = { + button: { + color: 'panelForegroundLabel', + paddingHorizontal: 10, + }, +}; + +export default SearchMessagesButton;