Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated css to resolve issue of rendering on android. Also added css … #2

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 44 additions & 29 deletions components/OrderTaking/OrderDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
StyleSheet,
TouchableOpacity,
FlatList,
Platform,
} from "react-native";
import Icon from "react-native-vector-icons/MaterialIcons";

Expand All @@ -22,36 +23,38 @@ const OrderDetails = ({
}, [orders]);

const renderOrderItem = ({ item, index }) => (
<View style={styles.orderItem}>
<TouchableOpacity
onPress={() => removeItem(index)}
style={styles.removeItemButton}
>
<Icon name="close" size={30} color="#f00" />
</TouchableOpacity>
<View style={styles.itemDetailsContainer}>
<Text style={styles.itemName}>{item.name}</Text>
<Text style={styles.itemPrice}>@ ₹ {item.price.toFixed(2)}</Text>
</View>
<View style={styles.quantityContainer}>
<View style={styles.quantityManipulator}>
<TouchableOpacity
onPress={() => decreaseQuantity(index)}
style={styles.quantityButton}
>
<Icon name="remove" size={24} color="#000" />
</TouchableOpacity>
<Text style={styles.quantityText}>{item.quantity}</Text>
<TouchableOpacity
onPress={() => increaseQuantity(index)}
style={styles.quantityButton}
>
<Icon name="add" size={24} color="#000" />
</TouchableOpacity>
<View style={styles.container}>
<View style={styles.orderItem}>
<TouchableOpacity
onPress={() => removeItem(index)}
style={styles.removeItemButton}
>
<Icon name="close" size={30} color="#f00" />
</TouchableOpacity>
<View style={styles.itemDetailsContainer}>
<Text style={styles.itemName}>{item.name}</Text>
<Text style={styles.itemPrice}>@ ₹ {item.price.toFixed(2)}</Text>
</View>
<View style={styles.quantityContainer}>
<View style={styles.quantityManipulator}>
<TouchableOpacity
onPress={() => decreaseQuantity(index)}
style={styles.quantityButton}
>
<Icon name="remove" size={24} color="#000" />
</TouchableOpacity>
<Text style={styles.quantityText}>{item.quantity}</Text>
<TouchableOpacity
onPress={() => increaseQuantity(index)}
style={styles.quantityButton}
>
<Icon name="add" size={24} color="#000" />
</TouchableOpacity>
</View>
<Text style={styles.totalItemPrice}>
₹ {(item.price * item.quantity).toFixed(2)}
</Text>
</View>
<Text style={styles.totalItemPrice}>
₹ {(item.price * item.quantity).toFixed(2)}
</Text>
</View>
</View>
);
Expand All @@ -75,6 +78,9 @@ const OrderDetails = ({
};

const styles = StyleSheet.create({
container: {
flex: 1,
},
orderDetails: {
padding: 10,
backgroundColor: "#fff",
Expand All @@ -87,6 +93,15 @@ const styles = StyleSheet.create({
paddingVertical: 10,
borderBottomWidth: 1,
borderColor: "#ccc",
...Platform.select({
android: {
// backgroundColor: "red",
// borderBottomWidth: 5,
},
ios: {
// iOS-specific styles
},
}),
},
removeItemButton: {
paddingHorizontal: 5,
Expand Down