Question: App.js : import { Text, SafeAreaView, StyleSheet } from 'react - native'; import { Card } from 'react - native - paper'; import AssetExample from

App.js : import { Text, SafeAreaView, StyleSheet } from 'react-native';
import { Card } from 'react-native-paper';
import AssetExample from './components/AssetExample';
import Category1 from './components/Category1';
export default function App(){
return (
Welcome to POG
Fresh, High Quality Produce
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
// justifyContent: 'center',
backgroundColor: '#ecf0f1',
padding: 8,
},
headerTitle: {
margin: 14,
fontSize: 38,
fontWeight: 'bold',
textAlign: 'center',
},
subTitle: {
margin: 14,
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
},
});
Component/Category1.js
import React, { useState } from 'react';
import { View, Text, Image, StyleSheet,Button } from 'react-native';
import { Picker } from '@react-native-picker/picker';
export default function Category1(){
const [selectedFruit, setSelectedFruit]= useState('select');
const [selectedQuantity, setSelectedQuantity]= useState('quantity');
const [totalPrice, setTotalPrice]= useState(0);
const fruitPrices ={
apple: 2,
banana: 3,
orange: 3,
grapes: 4,
mango: 5
};
const addToBasket =()=>{
const price = fruitPrices[selectedFruit];
const subtotal = price * selectedQuantity;
const newTotalPrice = totalPrice + subtotal;
setTotalPrice(newTotalPrice);
console.log(`Adding ${selectedQuantity} ${selectedFruit}(s) to the basket. Total cost: $${newTotalPrice}`);
// You can implement the functionality to add to basket here
};
return (
Fruits
setSelectedFruit(itemValue)}
>
setSelectedQuantity(itemValue)}
>
Total Price: ${totalPrice.toFixed(2)}
);
}
const styles = StyleSheet.create({
fruits: {
width: '100%',
height: 200,
borderTopLeftRadius: 10,
borderTopRightRadius: 10,
},
title: {
fontSize: 20,
fontWeight: 'bold',
textAlign: 'center',
paddingVertical: 10,
},
});
import { Text, View, StyleSheet, Image } from 'react-native';
export default function AssetExample(){
return (
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
padding: 5,
backgroundColor: '#ecf0f1',
borderColor: '#ecf0f1',
},
logo: {
height: 200,
width: 340,
marginBottom:45
}
});
AssetExample.js
import { Text, View, StyleSheet, Image } from 'react-native';
export default function AssetExample(){
return (
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
padding: 5,
backgroundColor: '#ecf0f1',
borderColor: '#ecf0f1',
},
logo: {
height: 200,
width: 340,
marginBottom:45
}
});
How do I enter this code into snack expo?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!