app crash from fill b upload

This commit is contained in:
Jaanu423
2026-01-13 16:03:47 +05:30
parent 39924066bc
commit e5f13c81f4
7 changed files with 152 additions and 81 deletions
+40 -14
View File
@@ -1,24 +1,30 @@
import { StyleSheet, Text, View, ScrollView, StatusBar, TouchableOpacity } from 'react-native'
import React from 'react'
import { StyleSheet, Text, View, ScrollView, StatusBar, TouchableOpacity, RefreshControl } from 'react-native'
import React, { useEffect } from 'react'
import { InsideHeader } from '../../Component/Index'
import colors from '../../Constant/Color'
import { useNavigation, useRoute } from '@react-navigation/native'
import { useProceedToBid } from '../../Services/BBPS/Hooks'
import { useFetchTenderById, useProceedToBid } from '../../Services/BBPS/Hooks'
const ProceedToBidDetail = () => {
// Sample data based on your JSON
const route = useRoute()
const tenderData = route.params?.tender;
const {data, refetch} = useProceedToBid(tenderData?.tenderId);
const route = useRoute<any>();
const tenderDataId = route.params?.tender;
const { data, refetch } = useProceedToBid(tenderDataId?.tenderId);
const { data: tenderResponse , refetch:tenderRefetch}: any = useFetchTenderById(tenderDataId?.tenderId);
const tenderData = tenderResponse?.data;
const [refreshing, setRefreshing] = React.useState(false);
console.log("proceed to bid tender detail : ", tenderData)
console.log("proceed to bid tender detail : ", tenderDataId)
console.log("proceed to data detail : ", data)
console.log("tender data for updated : ", tenderData)
const navigation = useNavigation<any>()
// Format date from array
const handleStartBidding = () => {
refetch();
if (data) {
navigation.navigate('TenderBidding', { tenderData: tenderData , bidData: data.data });
console.log(" ppp",tenderData ,"ll",data)
navigation.navigate('TenderBidding', { tenderData: tenderData, bidData: data.data });
}
}
const formatDate = (dateArray: any[]) => {
@@ -28,7 +34,7 @@ const ProceedToBidDetail = () => {
};
// Status indicator component
const StatusIndicator = ({ status, label }) => (
const StatusIndicator = ({ status, label }: { status: boolean; label: string }) => (
<View style={styles.statusContainer}>
<View style={[styles.statusDot, { backgroundColor: status ? colors.success : colors.error }]} />
<Text style={[styles.statusText, { color: status ? colors.success : colors.error }]}>
@@ -38,7 +44,7 @@ const ProceedToBidDetail = () => {
);
// Envelope log card component
const EnvelopeLogCard = ({ log, title }) => (
const EnvelopeLogCard = ({ log, title }: { log: any; title: string }) => (
<View style={styles.envelopeCard}>
<View style={styles.cardHeader}>
<Text style={styles.cardTitle}>{title}</Text>
@@ -82,7 +88,7 @@ const ProceedToBidDetail = () => {
);
// Information row component
const InfoRow = ({ label, value, isHighlighted = false }) => (
const InfoRow = ({ label, value, isHighlighted = false }: { label: string; value: string; isHighlighted?: boolean }) => (
<View style={styles.infoRow}>
<Text style={styles.infoLabel}>{label}:</Text>
<Text style={[styles.infoValue, isHighlighted && styles.highlightedValue]}>{value}</Text>
@@ -90,7 +96,7 @@ const ProceedToBidDetail = () => {
);
// Feature chip component
const FeatureChip = ({ label, enabled }) => (
const FeatureChip = ({ label, enabled }: { label: string; enabled: boolean }) => (
<View style={[styles.chip, { backgroundColor: enabled ? colors.successLight : colors.lightGray }]}>
<Text style={[styles.chipText, { color: enabled ? colors.success : colors.darkGray }]}>
{label} {enabled ? '✓' : '✗'}
@@ -98,12 +104,32 @@ const ProceedToBidDetail = () => {
</View>
);
const onRefresh = async () => {
try {
setRefreshing(true);
await refetch();
} finally {
setRefreshing(false);
}
};
useEffect(()=>{
tenderRefetch()
},[tenderDataId?.tenderId])
return (
<View style={{ flex: 1, backgroundColor: colors.white }}>
<StatusBar backgroundColor={colors.primary} barStyle="light-content" />
<InsideHeader title="Tender Detail" showArrow />
<ScrollView style={styles.container} showsVerticalScrollIndicator={false}>
<ScrollView style={styles.container} showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
colors={[colors.primary]} // Android
tintColor={colors.primary} // iOS
/>
}>
{/* Tender Header Section */}
<View style={styles.headerCard}>
<View style={styles.tenderHeader}>