diff --git a/app/components/channel_bookmarks/channel_bookmark/bookmark_document.tsx b/app/components/channel_bookmarks/channel_bookmark/bookmark_document.tsx index 20bb4a711a1..12d2b2b5f02 100644 --- a/app/components/channel_bookmarks/channel_bookmark/bookmark_document.tsx +++ b/app/components/channel_bookmarks/channel_bookmark/bookmark_document.tsx @@ -2,12 +2,13 @@ // See LICENSE.txt for license information. import {Button} from '@rneui/base'; -import React, {useCallback, useRef, useState} from 'react'; +import React, {useCallback, useRef} from 'react'; import {StyleSheet, View} from 'react-native'; import Document, {type DocumentRef} from '@components/document'; import ProgressBar from '@components/progress_bar'; import {useTheme} from '@context/theme'; +import {useDownloadFileAndPreview} from '@hooks/files'; import BookmarkDetails from './bookmark_details'; @@ -33,9 +34,9 @@ const styles = StyleSheet.create({ }); const BookmarkDocument = ({bookmark, canDownloadFiles, file, onLongPress}: Props) => { - const [progress, setProgress] = useState(0); const document = useRef(null); const theme = useTheme(); + const {progress, toggleDownloadAndPreview} = useDownloadFileAndPreview(); const handlePress = useCallback(async () => { if (document.current) { @@ -47,7 +48,7 @@ const BookmarkDocument = ({bookmark, canDownloadFiles, file, onLongPress}: Props