Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394707
D9209.id31155.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9209.id31155.diff
View Options
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';
@@ -23,7 +24,7 @@
+innerSearchAutoFocus?: boolean,
+innerSearchActive?: boolean,
};
-function ChatThreadListSearch(props: Props): React.Node {
+function ForwardedChatThreadListSearch(props: Props, ref): React.Node {
const {
searchText,
onChangeText,
@@ -78,7 +79,6 @@
],
[searchCancelButtonProgress, styles.cancelSearchButtonText],
);
- const searchInputRef = React.useRef();
return (
<>
<Button
@@ -97,7 +97,7 @@
containerStyle={styles.search}
onBlur={onBlur}
placeholder="Search chats"
- ref={searchInputRef}
+ ref={ref}
autoFocus={innerSearchAutoFocus}
active={innerSearchActive}
/>
@@ -146,4 +146,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>
@@ -359,6 +360,7 @@
searchStatus={searchStatus}
onSearchCancel={onSearchCancel}
innerSearchAutoFocus={true}
+ ref={searchInputRef}
/>
</View>
) : null,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 9:16 PM (21 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606140
Default Alt Text
D9209.id31155.diff (2 KB)
Attached To
Mode
D9209: [native] Forward `searchInputRef` from `ChatThreadList` to `ChatThreadListSearch`
Attached
Detach File
Event Timeline
Log In to Comment