Page MenuHomePhabricator

D9209.diff
No OneTemporary

D9209.diff

diff --git a/native/chat/chat-thread-list-search.react.js b/native/chat/chat-thread-list-search.react.js
--- a/native/chat/chat-thread-list-search.react.js
+++ b/native/chat/chat-thread-list-search.react.js
@@ -1,6 +1,7 @@
// @flow
import * as React from 'react';
+import { TextInput as BaseTextInput } from 'react-native';
import Animated from 'react-native-reanimated';
import type { SearchStatus } from './chat-thread-list.react.js';
@@ -24,7 +25,7 @@
+innerSearchAutoFocus?: boolean,
+innerSearchActive?: boolean,
};
-function ChatThreadListSearch(props: Props): React.Node {
+function ForwardedChatThreadListSearch(props: Props, ref): React.Node {
const {
searchText,
onChangeText,
@@ -79,7 +80,6 @@
],
[searchCancelButtonProgress, styles.cancelSearchButtonText],
);
- const searchInputRef = React.useRef();
return (
<>
<Button
@@ -98,7 +98,7 @@
containerStyle={styles.search}
onBlur={onBlur}
placeholder="Search chats"
- ref={searchInputRef}
+ ref={ref}
autoFocus={innerSearchAutoFocus}
active={innerSearchActive}
/>
@@ -147,4 +147,13 @@
backgroundColor: 'listBackground',
},
};
+
+const ChatThreadListSearch: React.AbstractComponent<
+ Props,
+ React.ElementRef<typeof BaseTextInput>,
+> = React.forwardRef<Props, React.ElementRef<typeof BaseTextInput>>(
+ ForwardedChatThreadListSearch,
+);
+ChatThreadListSearch.displayName = 'ChatThreadListSearch';
+
export default ChatThreadListSearch;
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
@@ -246,6 +246,7 @@
searchStatus={searchStatus}
onSearchCancel={onSearchCancel}
innerSearchActive={false}
+ ref={searchInputRef}
/>
</View>
</TouchableWithoutFeedback>
@@ -361,6 +362,7 @@
searchStatus={searchStatus}
onSearchCancel={onSearchCancel}
innerSearchAutoFocus={true}
+ ref={searchInputRef}
/>
</View>
);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 1:48 AM (22 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595409
Default Alt Text
D9209.diff (2 KB)

Event Timeline