main e com code
// App.js - Main entry for React Native e-commerce app with UPI QR Payment import React from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import HomeScreen from './screens/HomeScreen'; import ProductDetails from './screens/ProductDetails'; import PaymentScreen from './screens/PaymentScreen'; import SuccessScreen from './screens/SuccessScreen';
const Stack = createNativeStackNavigator();
export default function App() {
return (
// --- screens/HomeScreen.js --- import React from 'react'; import { View, Text, FlatList, TouchableOpacity, StyleSheet } from 'react-native';
const products = [ { id: '1', name: 'Zebronics Power Bank', price: 799 }, { id: '2', name: 'Crompton LED Bulb Pack', price: 350 }, ];
export default function HomeScreen({ navigation }) {
return (
const styles = StyleSheet.create({ container: { flex: 1, padding: 16 }, card: { padding: 16, backgroundColor: '#f0f0f0', marginBottom: 10, borderRadius: 8 }, name: { fontWeight: 'bold', fontSize: 16 }, });
// --- screens/ProductDetails.js --- import React from 'react'; import { View, Text, Button, StyleSheet } from 'react-native';
export default function ProductDetails({ route, navigation }) {
const { product } = route.params;
return (
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center' }, title: { fontSize: 22, fontWeight: 'bold', marginBottom: 10 }, price: { fontSize: 18, marginBottom: 20 }, });
// --- screens/PaymentScreen.js --- import React, { useState } from 'react'; import { View, Text, TextInput, Button, Image, StyleSheet } from 'react-native';
export default function PaymentScreen({ route, navigation }) { const { product } = route.params; const [name, setName] = useState(''); const [email, setEmail] = useState(''); const [screenshot, setScreenshot] = useState(null);
const handlePayment = () => { if (name && email) { navigation.navigate('Success', { name, product }); } else { alert('कृपया सर्व माहिती भरा'); } };
return (
const styles = StyleSheet.create({ container: { padding: 20, alignItems: 'center' }, qr: { height: 200, width: 200, marginVertical: 20 }, input: { borderWidth: 1, width: '100%', marginBottom: 10, padding: 8, borderRadius: 4 }, });
// --- screens/SuccessScreen.js --- import React from 'react'; import { View, Text, Button, StyleSheet } from 'react-native';
export default function SuccessScreen({ route, navigation }) {
const { name, product } = route.params;
return (
const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20 }, text: { fontSize: 18, textAlign: 'center', marginBottom: 10 }, });
0 comments :
Please do not enter any spam link in the comment box.