From cf5e38774ea47a82f65a914fa02e99437dc5df7f Mon Sep 17 00:00:00 2001 From: Leslie Ngo Date: Wed, 28 Sep 2022 17:10:20 -0700 Subject: [PATCH] topic edit modal [nfc]: Convert SearchMessagesCard to function component to allow calling TopicModalProvider Context hook within. --- src/search/SearchMessagesCard.js | 66 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/search/SearchMessagesCard.js b/src/search/SearchMessagesCard.js index bf34f5877cb..da94b7d4386 100644 --- a/src/search/SearchMessagesCard.js +++ b/src/search/SearchMessagesCard.js @@ -1,6 +1,6 @@ /* @flow strict-local */ -import React, { PureComponent } from 'react'; +import React from 'react'; import type { Node } from 'react'; import { View } from 'react-native'; @@ -22,42 +22,40 @@ type Props = $ReadOnly<{| isFetching: boolean, |}>; -export default class SearchMessagesCard extends PureComponent { - render(): Node { - const { isFetching, messages } = this.props; +export default function SearchMessagesCard(props: Props): Node { + const { narrow, isFetching, messages } = props; - if (isFetching) { - // Display loading indicator only if there are no messages to - // display from a previous search. - if (!messages || messages.length === 0) { - return ; - } - } - - if (!messages) { - return null; + if (isFetching) { + // Display loading indicator only if there are no messages to + // display from a previous search. + if (!messages || messages.length === 0) { + return ; } + } - if (messages.length === 0) { - return ; - } + if (!messages) { + return null; + } - return ( - - undefined} - /> - - ); + if (messages.length === 0) { + return ; } + + return ( + + undefined} + /> + + ); }