latest code with fix modal back Press problem

This commit is contained in:
rohit-kumar-fullstack
2026-01-13 11:53:07 +05:30
parent ffc7e4ead0
commit aa740a608e
11 changed files with 190 additions and 164 deletions
+12 -25
View File
@@ -1,6 +1,5 @@
import React, { memo, useState } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform } from 'react-native';
import Modal from 'react-native-modal';
import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform, Modal } from 'react-native';
import { Package, IndianRupee, FileText, Download, ArrowLeft, Info, } from 'lucide-react-native';
import colors from '../../../Constant/Color';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -40,16 +39,15 @@ const AuctionItemDetail: React.FC<Props> = ({ visible, onClose, data }) => {
setAllBoolean((prev: any) => ({ ...prev, fileLoading: true }));
const { dirs } = ReactNativeBlobUtil.fs;
// ✅ PUBLIC DOWNLOADS DIRECTORY
const path = `${dirs.DownloadDir}/${fileName}.pdf`;
console.log('📂 Saving to:', path);
// console.log('Saving to:', path);
const downloadUrl = `${AUCTION_ITEM_DOCUMENT_DOWNLOAD}?auctionItemId=${id}`;
console.log('🌐 Download URL:', downloadUrl);
// console.log('Download URL:', downloadUrl);
const response = await ReactNativeBlobUtil.config({
fileCache: false, // important for public folder
fileCache: false,
addAndroidDownloads: {
useDownloadManager: true,
notification: true,
@@ -57,41 +55,30 @@ const AuctionItemDetail: React.FC<Props> = ({ visible, onClose, data }) => {
mime: 'application/pdf',
title: `${fileName}.pdf`,
description: 'Downloading document',
mediaScannable: true, // 👈 makes it visible instantly
mediaScannable: true,
},
}).fetch('GET', downloadUrl, {
Accept: 'application/pdf',
});
console.log('✅ Download completed');
console.log('📦 Status:', response.info().status);
console.log('📦 Headers:', response.info().headers);
console.log('📍 Saved at:', path);
const stat = await ReactNativeBlobUtil.fs.stat(path);
console.log('📦 File size:', stat.size);
console.log(' File size:', stat.size);
} catch (error: any) {
console.log('❌ Download failed');
console.log('❌ Error:', error?.message || error);
console.log('Error:', error?.message || error);
} finally {
setAllBoolean((prev: any) => ({ ...prev, fileLoading: false }));
}
};
console.log(data, 'kkkkk---');
return (
<Modal
isVisible={visible}
style={styles.fullModal}
animationIn="fadeIn"
animationOut="fadeOut"
animationInTiming={360}
animationOutTiming={280}
visible={visible}
transparent={false}
animationType="none"
statusBarTranslucent
backdropColor="transparent"
backdropOpacity={0}
useNativeDriver
onRequestClose={onClose}
>
<View style={styles.safeArea}>