updated: discount model

parent 072bc4f4
......@@ -17,7 +17,7 @@ import {
import { MaterialIcons } from '@expo/vector-icons';
import { gamification } from "../screen/gamification";
import { useNavigation } from '@react-navigation/native';
export function BottomTab() {
const navigation = useNavigation();
return(
......@@ -60,6 +60,12 @@ export function BottomTab() {
<Ionicons name="home" size={24} color="black" />
<Text>Home</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.barButtonView}
onPress={() => navigation.navigate("PriceScreen")}
>
<Entypo name="user" size={24} color="black" />
<Text>Profile</Text>
</TouchableOpacity>
</View>
);
}
......
......@@ -68,7 +68,7 @@ const fetchData = async () => {
{data.map((data) =>(
<TouchableOpacity style={styles.touchable} onPress={() => navigation.navigate('PriceScreen', {picture: data.userID.prof_img_name})}>
// <TouchableOpacity style={styles.touchable} onPress={() => navigation.navigate('PriceScreen', {picture: data.userID.prof_img_name})}>
<View style={styles.card}>
{/* <View style={styles.left}>
......@@ -89,7 +89,7 @@ const fetchData = async () => {
<Text >Points: {data.points}</Text>
</View>
</View>
</TouchableOpacity>
// {/* </TouchableOpacity> */}
))}
{/* ) )} */}
......
......@@ -20,29 +20,53 @@ import { SignIn } from "./SignIn";
import axios from "axios";
import { BottomTab } from "../Navigations/BottomTab";
export function PriceScreen({ navigation, data, route }) {
const {picture} = route.params
useEffect(() => {
getImage(picture);
}, []);
export function PriceScreen({ navigation }) {
const [discount, setDiscount] = useState("");
// data, route
// const {picture} = route.params
// useEffect(() => {
// getImage(picture);
// }, []);
const fetchData = async () => {
// const resp = await fetch("http://192.168.8.126:5000/getDetails", {method:"POST"});
axios({
method: "GET",
url: "http://192.168.8.126:5000/discount/<id>",
})
.then(function (response) {
console.log(response.data.message);
// data = response.data
setDiscount(response.data.message);
})
.catch(function (error) {
console.log("axios error" + error);
});
};
useEffect(() => {
fetchData();
},[]);
function name() {
axios
}
const [image, setImage] = useState('');
// const [image, setImage] = useState('');
//get the token and id from headers
//from the id get the
const getImage = async (name) => {
console.log(name)
const q = name.split(' ').join('+')
const img = await fetch(`http://192.168.8.126:5000/getimage/${name}`)
const image = await img.json();
console.log(image)
setImage(image.previewURL)
// const getImage = async (name) => {
// console.log(name)
// const q = name.split(' ').join('+')
// const img = await fetch(`http://192.168.8.126:5000/getimage/${name}`)
// const image = await img.json();
// console.log(image)
// setImage(image.previewURL)
}
// }
const [details, setDetails] = useState({
name: "",
......@@ -156,7 +180,7 @@ const getImage = async (name) => {
<View style={styles.con}>
<Text>
{
<Image source={{ uri: `http://192.168.8.126:5000/getimage/${picture}` }} style={{ width: 200, height: 200 }} />
<Image source={{}} style={{ width: 200, height: 200 }} />
}
</Text>
......@@ -254,7 +278,7 @@ const getImage = async (name) => {
</TouchableOpacity>
</View>
<View>
<Text style={styles.text1}>You have earned 5% Discount</Text>
<Text style={styles.text1}>You have earned {discount}% Discount</Text>
</View>
</View>
</View>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment