Page MenuHomePhabricator

D9171.diff
No OneTemporary

D9171.diff

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
@@ -7,7 +7,6 @@
View,
FlatList,
Platform,
- TextInput,
TouchableWithoutFeedback,
BackHandler,
} from 'react-native';
@@ -134,10 +133,14 @@
+renderSearch: (
additionalProps?: $Shape<React.ElementConfig<typeof Search>>,
) => React.Node,
+ +onPressItem: (
+ threadInfo: ThreadInfo,
+ pendingPersonalThreadUserInfo?: UserInfo,
+ ) => void,
+ +onPressSeeMoreSidebars: (threadInfo: ThreadInfo) => void,
};
class ChatThreadList extends React.PureComponent<Props> {
- searchInput: ?React.ElementRef<typeof TextInput>;
flatList: ?FlatList<Item>;
clearNavigationBlurListener: ?() => mixed;
@@ -234,10 +237,6 @@
}
};
- searchInputRef = (searchInput: ?React.ElementRef<typeof TextInput>) => {
- this.searchInput = searchInput;
- };
-
renderItem = (row: { item: Item, ... }) => {
const item = row.item;
if (item.type === 'search') {
@@ -254,8 +253,8 @@
return (
<ChatThreadListItem
data={item}
- onPressItem={this.onPressItem}
- onPressSeeMoreSidebars={this.onPressSeeMoreSidebars}
+ onPressItem={this.props.onPressItem}
+ onPressSeeMoreSidebars={this.props.onPressSeeMoreSidebars}
onSwipeableWillOpen={this.props.onSwipeableWillOpen}
currentlyOpenedSwipeableId={this.props.openedSwipeableID}
/>
@@ -376,28 +375,6 @@
flatListRef = (flatList: ?FlatList<Item>) => {
this.flatList = flatList;
};
-
- onPressItem = (
- threadInfo: ThreadInfo,
- pendingPersonalThreadUserInfo?: UserInfo,
- ) => {
- this.props.onChangeSearchText('');
- if (this.searchInput) {
- this.searchInput.blur();
- }
- this.props.navigateToThread({ threadInfo, pendingPersonalThreadUserInfo });
- };
-
- onPressSeeMoreSidebars = (threadInfo: ThreadInfo) => {
- this.props.onChangeSearchText('');
- if (this.searchInput) {
- this.searchInput.blur();
- }
- this.props.navigation.navigate<'SidebarListModal'>({
- name: SidebarListModalRouteName,
- params: { threadInfo },
- });
- };
}
const unboundStyles = {
@@ -632,6 +609,31 @@
],
);
+ const onPressItem = React.useCallback(
+ (threadInfo: ThreadInfo, pendingPersonalThreadUserInfo?: UserInfo) => {
+ onChangeSearchText('');
+ if (searchInputRef.current) {
+ searchInputRef.current.blur();
+ }
+ navigateToThread({ threadInfo, pendingPersonalThreadUserInfo });
+ },
+ [navigateToThread, onChangeSearchText],
+ );
+
+ const onPressSeeMoreSidebars = React.useCallback(
+ (threadInfo: ThreadInfo) => {
+ onChangeSearchText('');
+ if (searchInputRef.current) {
+ this.searchInputRef.current.blur();
+ }
+ navigation.navigate<'SidebarListModal'>({
+ name: SidebarListModalRouteName,
+ params: { threadInfo },
+ });
+ },
+ [navigation, onChangeSearchText],
+ );
+
return (
<ChatThreadList
navigation={navigation}
@@ -669,6 +671,8 @@
onSearchCancel={onSearchCancel}
onSearchFocus={onSearchFocus}
renderSearch={renderSearch}
+ onPressItem={onPressItem}
+ onPressSeeMoreSidebars={onPressSeeMoreSidebars}
/>
);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 23, 9:37 PM (20 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2354475
Default Alt Text
D9171.diff (3 KB)

Event Timeline