diff --git a/native/chat/chat-thread-list.react.js b/native/chat/chat-thread-list.react.js --- a/native/chat/chat-thread-list.react.js +++ b/native/chat/chat-thread-list.react.js @@ -127,6 +127,8 @@ +onChangeSearchText: (searchText: string) => Promise, +scrollPos: { current: number }, +onScroll: (event: ScrollEvent) => void, + +onSwipeableWillOpen: (threadInfo: ThreadInfo) => void, + +composeThread: () => void, }; class ChatThreadList extends React.PureComponent { @@ -316,7 +318,7 @@ data={item} onPressItem={this.onPressItem} onPressSeeMoreSidebars={this.onPressSeeMoreSidebars} - onSwipeableWillOpen={this.onSwipeableWillOpen} + onSwipeableWillOpen={this.props.onSwipeableWillOpen} currentlyOpenedSwipeableId={this.props.openedSwipeableID} /> ); @@ -393,7 +395,7 @@ ); @@ -458,23 +460,6 @@ params: { threadInfo }, }); }; - - onSwipeableWillOpen = (threadInfo: ThreadInfo) => { - this.props.setOpenedSwipeableID(threadInfo.id); - }; - - composeThread = () => { - const { loggedInUserInfo } = this.props; - if (!loggedInUserInfo) { - return; - } - const threadInfo = createPendingThread({ - viewerID: loggedInUserInfo.id, - threadType: threadTypes.PRIVATE, - members: [loggedInUserInfo], - }); - this.props.navigateToThread({ threadInfo, searching: true }); - }; } const unboundStyles = { @@ -604,6 +589,23 @@ [searchStatus], ); + const onSwipeableWillOpen = React.useCallback( + (threadInfo: ThreadInfo) => setOpenedSwipeableID(threadInfo.id), + [], + ); + + const composeThread = React.useCallback(() => { + if (!loggedInUserInfo) { + return; + } + const threadInfo = createPendingThread({ + viewerID: loggedInUserInfo.id, + threadType: threadTypes.PRIVATE, + members: [loggedInUserInfo], + }); + navigateToThread({ threadInfo, searching: true }); + }, [loggedInUserInfo, navigateToThread]); + return ( ); }