-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
32 lines (27 loc) · 1022 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// src/App.js
import React, { useState } from 'react';
import { View } from 'react-native';
import ProductSelector from './components/ProductSelector';
import PincodeInput from './components/PincodeInput';
import DeliveryDate from './components/DeliveryDate';
const App = () => {
const [selectedProduct, setSelectedProduct] = useState(null);
const [deliveryDate, setDeliveryDate] = useState('');
const handleProductSelect = (product) => {
setSelectedProduct(product);
};
const handlePincodeSubmit = (pincode) => {
// Simulate delivery date calculation based on pincode
const estimatedDate = new Date();
estimatedDate.setDate(estimatedDate.getDate() + 3); // Example: 3 days later
setDeliveryDate(estimatedDate.toDateString());
};
return (
<View>
<ProductSelector onSelect={handleProductSelect} />
{selectedProduct && <PincodeInput onSubmit={handlePincodeSubmit} />}
{deliveryDate && <DeliveryDate date={deliveryDate} />}
</View>
);
};
export default App;