Question: import React, { useState } from 'react'; import { View, Text, StyleSheet, Button } from 'react - native'; import { Picker } from ' @react

import React, { useState } from 'react';
import { View, Text, 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('0');
const [totalPrice, setTotalPrice]= useState(0);
const fruitPrices ={
apple: 12,
banana: 23,
orange: 13,
grapes: 34,
mango: 15,
};
const vegetablePrices ={
potato: 5,
carrot: 8,
tomato: 5,
cucumber: 7,
spinach: 8,
};
const addToBasket =()=>{
const price = fruitPrices[selectedFruit]|| vegetablePrices[selectedFruit];
const subtotal = price * parseInt(selectedQuantity);
const newTotalPrice = totalPrice + subtotal;
setTotalPrice(newTotalPrice);
console.log(`Adding ${selectedQuantity} ${selectedFruit}(s) to the basket. Total cost: $${newTotalPrice}`);
};
return (
Vegetables
setSelectedFruit(itemValue)}
style={styles.picker}
>
Fruits
setSelectedFruit(itemValue)}
style={styles.picker}
>
Quantity
setSelectedQuantity(itemValue)}
style={styles.picker}
>
{[...Array(5).keys()].map((i)=>(
))}
Total Cost of Order: ${totalPrice.toFixed(2)}
App developed by Bob, Bobb, and Bobbi
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
padding: 20,
backgroundColor: '#ecf0f1',
borderColor: '#ecf0f1',
},
title: {
fontSize: 20,
fontWeight: 'bold',
textAlign: 'center',
paddingVertical: 10,
},
picker: {
width: '100%',
height: 50,
borderColor: '#ccc',
borderWidth: 1,
marginVertical: 10,
},
totalPrice: {
fontSize: 20,
fontWeight: 'bold',
textAlign: 'center',
paddingVertical: 10,
},
footer: {
fontSize: 12,
textAlign: 'center',
marginTop: 20,
},
});
Q: What part of this code needs to be fixed so that 'App developed by Bob, Bobb, Bobby' is at the footer as a label, underneath the calculate button on snack expo on a snack?

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!