29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
// Metro module 9402 (f9403).
|
|
import { useRef, useMemo } from "react";
|
|
import UserStore from "../../../../../stores/UserStore";
|
|
import { useStateFromStores } from "../../../../../_bundle/Module589";
|
|
import PremiumUtils from "../../../../../utils/PremiumUtils";
|
|
import { debounce } from "../../../../../_bundle/Module12";
|
|
export default function useEmojiPickerViewableItemsChanged(a0) {
|
|
let c17193_0 = a0;
|
|
const ref = useRef(0);
|
|
const stateFromStores = useStateFromStores([UserStore], () => {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const canUseEmojisEverywhere = PremiumUtils.canUseEmojisEverywhere(currentUser);
|
|
return canUseEmojisEverywhere ? !PremiumUtils.canUseAnimatedEmojis(currentUser) : !canUseEmojisEverywhere;
|
|
});
|
|
return useMemo(() => {
|
|
let c26433_0 = debounce(() => {
|
|
c17193_0(ref.current > 7);
|
|
}, 200);
|
|
return {
|
|
onViewableItemsChanged: stateFromStores ? (a0) => {
|
|
for (const item of a0.changed) {
|
|
ref.current = Math.max(0, ref.current + (item.item?.isSectionNitroLocked === true ? item.isViewable ? 1 : -1 : 0));
|
|
}
|
|
c26433_0();
|
|
} : void 0
|
|
};
|
|
}, [a0, stateFromStores]);
|
|
};
|