upd: modal loading saat open file
Deskripsi: - dokumen divisi - banner - project - kegiatan divisi No Issues
This commit is contained in:
@@ -4,6 +4,7 @@ import BorderBottomItem from "@/components/borderBottomItem"
|
||||
import ButtonBackHeader from "@/components/buttonBackHeader"
|
||||
import DrawerBottom from "@/components/drawerBottom"
|
||||
import MenuItemRow from "@/components/menuItemRow"
|
||||
import ModalLoading from "@/components/modalLoading"
|
||||
import Styles from "@/constants/Styles"
|
||||
import { apiDeleteBanner, apiGetBanner } from "@/lib/api"
|
||||
import { setEntities } from "@/lib/bannerSlice"
|
||||
@@ -34,6 +35,7 @@ export default function BannerList() {
|
||||
const [selectFile, setSelectFile] = useState<Props | null>(null)
|
||||
const dispatch = useDispatch()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||
|
||||
const handleDeleteEntity = async () => {
|
||||
try {
|
||||
@@ -66,6 +68,8 @@ export default function BannerList() {
|
||||
};
|
||||
|
||||
const openFile = () => {
|
||||
setModal(false)
|
||||
setLoadingOpen(true)
|
||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + selectFile?.image;
|
||||
const fileName = selectFile?.name + '.' + selectFile?.extension;
|
||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||
@@ -93,6 +97,8 @@ export default function BannerList() {
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||
} finally {
|
||||
setLoadingOpen(false)
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -108,7 +114,7 @@ export default function BannerList() {
|
||||
headerRight: () => <HeaderRightBannerList />
|
||||
}}
|
||||
/>
|
||||
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
|
||||
Reference in New Issue
Block a user