useInView rootMargin

This commit is contained in:
Martti Malmi 2023-12-13 11:25:15 +02:00
parent 3fa13de33e
commit b199d297ce
4 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ export function NoteInner(props: NoteProps) {
const [showReactions, setShowReactions] = useState(false);
const { isEventMuted } = useModeration();
const { ref, inView } = useInView({ triggerOnce: true });
const { ref, inView } = useInView({ triggerOnce: true, rootMargin: "2000px" });
const { reactions, reposts, deletions, zaps } = useEventReactions(NostrLink.fromEvent(ev), related);
const login = useLogin();
const { pinned, bookmarked } = useLogin();

View File

@ -19,7 +19,7 @@ export interface NoteReactionProps {
export default function NoteReaction(props: NoteReactionProps) {
const { data: ev } = props;
const { isMuted } = useModeration();
const { inView, ref } = useInView({ triggerOnce: true });
const { inView, ref } = useInView({ triggerOnce: true, rootMargin: "2000px" });
const profile = useUserProfile(inView ? ev.pubkey : "");
const refEvent = useMemo(() => {

View File

@ -23,7 +23,7 @@ const ShowMore = ({ text, onClick, className = "" }: ShowMoreProps) => {
export default ShowMore;
export function ShowMoreInView({ text, onClick, className }: ShowMoreProps) {
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "2000px" });
useEffect(() => {
if (inView) {

View File

@ -13,7 +13,7 @@ export default function LoadMore({
shouldLoadMore: boolean;
children?: React.ReactNode;
}) {
const { ref, inView } = useInView();
const { ref, inView } = useInView({ rootMargin: "2000px" });
const [tick, setTick] = useState<number>(0);
useEffect(() => {