40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
// Metro module 9347 (f9348).
|
|
import { useRef, useState, useCallback } from "react";
|
|
import EmojiStore from "../../../emojis/EmojiStore";
|
|
import { batchUpdates } from "../../../../_bundle/Module705";
|
|
import { FrecencyUserSettingsActionCreators } from "../../../user_settings/UserSettingsProtoActionCreators";
|
|
export default function useEmojiPickerSearchState(a0, a1, a2) {
|
|
const channel = a0;
|
|
const intention = a2;
|
|
const ref = useRef("");
|
|
const [searchResults, setState] = useState(null);
|
|
return {
|
|
handleTextChange: useCallback((a0) => {
|
|
let c26429_1;
|
|
const current = a0;
|
|
if (a0 !== "") {
|
|
const query = a0[0] === ":" ? a0.slice(1) : a0;
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
c26429_1 = EmojiStore.searchWithoutFetchingLatest({
|
|
channel,
|
|
query,
|
|
count: 0,
|
|
intention
|
|
});
|
|
batchUpdates(() => {
|
|
ref.current = current;
|
|
setState(c26429_1);
|
|
});
|
|
} else {
|
|
batchUpdates(() => {
|
|
ref.current = "";
|
|
setState(null);
|
|
a1.set(0);
|
|
});
|
|
}
|
|
}, [a1, a0, a2]),
|
|
searchQueryRef: ref,
|
|
searchResults
|
|
};
|
|
};
|