Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3048083
D9171.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9171.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9171: [native] Lift `onPressItem` and `onPressSeeMoreSidebars` to `ConnectedChatThreadList`
Attached
Detach File
Event Timeline
Log In to Comment