diff --git a/src/components/HighlightsPanel.tsx b/src/components/HighlightsPanel.tsx index b4687150..461de312 100644 --- a/src/components/HighlightsPanel.tsx +++ b/src/components/HighlightsPanel.tsx @@ -4,10 +4,10 @@ import { faHighlighter } from '@fortawesome/free-solid-svg-icons' import { Highlight } from '../types/highlights' import { HighlightItem } from './HighlightItem' import { useFilteredHighlights } from '../hooks/useFilteredHighlights' -import { usePullToRefresh } from '../hooks/usePullToRefresh' +import { usePullToRefresh } from 'use-pull-to-refresh' import HighlightsPanelCollapsed from './HighlightsPanel/HighlightsPanelCollapsed' import HighlightsPanelHeader from './HighlightsPanel/HighlightsPanelHeader' -import PullToRefreshIndicator from './PullToRefreshIndicator' +import RefreshIndicator from './RefreshIndicator' import { RelayPool } from 'applesauce-relay' import { IEventStore } from 'applesauce-core' import { UserSettings } from '../services/settingsService' @@ -60,7 +60,6 @@ export const HighlightsPanel: React.FC = ({ }) => { const [showHighlights, setShowHighlights] = useState(true) const [localHighlights, setLocalHighlights] = useState(highlights) - const highlightsListRef = useRef(null) const handleToggleHighlights = () => { const newValue = !showHighlights @@ -69,14 +68,15 @@ export const HighlightsPanel: React.FC = ({ } // Pull-to-refresh for highlights - const pullToRefreshState = usePullToRefresh(highlightsListRef, { + const { isRefreshing, pullPosition } = usePullToRefresh({ onRefresh: () => { if (onRefresh) { onRefresh() } }, - isRefreshing: loading, - disabled: !onRefresh + maximumPullLength: 240, + refreshThreshold: 80, + isDisabled: !onRefresh }) // Keep track of highlight updates @@ -144,15 +144,10 @@ export const HighlightsPanel: React.FC = ({

) : ( -
- + {filteredHighlights.map((highlight) => (