From 9e5f17a55cbd3336190b8d94b71988eab5622a00 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Fri, 1 Nov 2024 02:14:39 -0700 Subject: [PATCH] Rename to useScrollListener --- packages/desktop-client/src/components/ScrollProvider.tsx | 4 ++-- .../desktop-client/src/components/mobile/MobileNavTabs.tsx | 4 ++-- .../src/components/mobile/transactions/ListBox.jsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/desktop-client/src/components/ScrollProvider.tsx b/packages/desktop-client/src/components/ScrollProvider.tsx index fa9248b0ba4..159f747ace3 100644 --- a/packages/desktop-client/src/components/ScrollProvider.tsx +++ b/packages/desktop-client/src/components/ScrollProvider.tsx @@ -190,10 +190,10 @@ export function ScrollProvider({ ); } -export function useScrollEffect(listener: ScrollListener) { +export function useScrollListener(listener: ScrollListener) { const context = useContext(ScrollContext); if (!context) { - throw new Error('useScrollEffect must be used within a ScrollProvider'); + throw new Error('useScrollListener must be used within a ScrollProvider'); } const { registerListener, unregisterListener } = context; diff --git a/packages/desktop-client/src/components/mobile/MobileNavTabs.tsx b/packages/desktop-client/src/components/mobile/MobileNavTabs.tsx index a1f4c9e212e..8ce3aaeeac9 100644 --- a/packages/desktop-client/src/components/mobile/MobileNavTabs.tsx +++ b/packages/desktop-client/src/components/mobile/MobileNavTabs.tsx @@ -18,7 +18,7 @@ import { SvgCalendar } from '../../icons/v2'; import { useResponsive } from '../../ResponsiveProvider'; import { theme, styles } from '../../style'; import { View } from '../common/View'; -import { useScrollEffect } from '../ScrollProvider'; +import { useScrollListener } from '../ScrollProvider'; const COLUMN_COUNT = 3; const PILL_HEIGHT = 15; @@ -123,7 +123,7 @@ export function MobileNavTabs() { }); }; - useScrollEffect(({ isScrolling }) => { + useScrollListener(({ isScrolling }) => { if (isScrolling('down')) { hide(); } else { diff --git a/packages/desktop-client/src/components/mobile/transactions/ListBox.jsx b/packages/desktop-client/src/components/mobile/transactions/ListBox.jsx index c1c9c476ad2..f06a730f5e8 100644 --- a/packages/desktop-client/src/components/mobile/transactions/ListBox.jsx +++ b/packages/desktop-client/src/components/mobile/transactions/ListBox.jsx @@ -2,7 +2,7 @@ import React, { useRef } from 'react'; import { useListBox } from 'react-aria'; import { useListState } from 'react-stately'; -import { useScrollEffect } from '../../ScrollProvider'; +import { useScrollListener } from '../../ScrollProvider'; import { ListBoxSection } from './ListBoxSection'; @@ -12,7 +12,7 @@ export function ListBox(props) { const { listBoxProps, labelProps } = useListBox(props, state, listBoxRef); const { loadMore } = props; - useScrollEffect(({ hasScrolledToEnd }) => { + useScrollListener(({ hasScrolledToEnd }) => { const scrolledToBottom = hasScrolledToEnd('down', 5); if (scrolledToBottom) { loadMore?.();