upd: modal loading saat open file

Deskripsi:
- dokumen divisi
- banner
- project
- kegiatan divisi

No Issues
This commit is contained in:
2025-07-21 18:07:45 +08:00
parent a7655b1cc0
commit 88dd6165f2
4 changed files with 29 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import DrawerBottom from "@/components/drawerBottom";
import { InputForm } from "@/components/inputForm";
import MenuItemRow from "@/components/menuItemRow";
import ModalFloat from "@/components/modalFloat";
import ModalLoading from "@/components/modalLoading";
import ModalSelectMultiple from "@/components/modalSelectMultiple";
import Skeleton from "@/components/skeleton";
import { ColorsStatus } from "@/constants/ColorsStatus";
@@ -81,6 +82,7 @@ export default function DocumentDivision() {
const arrSkeleton = Array.from({ length: 3 })
const update = useSelector((state: any) => state.dokumenUpdate)
const [refreshing, setRefreshing] = useState(false)
const [loadingOpen, setLoadingOpen] = useState(false)
const [bodyRename, setBodyRename] = useState({
id: "",
name: "",
@@ -268,6 +270,7 @@ export default function DocumentDivision() {
const openFile = (item: Props) => {
setLoadingOpen(true)
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
const fileName = item.name + '.' + item.extension;
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
@@ -276,7 +279,6 @@ export default function DocumentDivision() {
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
const contentURL = await FileSystem.getContentUriAsync(uri);
try {
if (Platform.OS == 'android') {
// open with android intent
await startActivityAsync(
@@ -288,13 +290,15 @@ export default function DocumentDivision() {
}
);
// or
// Sharing.shareAsync(localPath);
// Sharing.shareAsync(localPath);
} else if (Platform.OS == 'ios') {
Sharing.shareAsync(localPath);
}
} catch (error) {
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
} finally {
setLoadingOpen(false)
}
});
};
@@ -345,6 +349,7 @@ export default function DocumentDivision() {
),
}}
/>
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
<ScrollView
style={{ height: "100%" }}
refreshControl={