Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdomekpotu committed Feb 6, 2023
1 parent aff4c74 commit ed04f39
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 7,011 deletions.
3 changes: 3 additions & 0 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import AsyncStorage from '@react-native-async-storage/async-storage';

import { Provider } from 'react-redux';
import { store } from './redux/store';

//import screens
import {
Budget,
Expand Down
5 changes: 5 additions & 0 deletions endpoints/allerges.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import axios from '../services/api';

export function fetchAllergens() {
return axios.get('/allergens');
}
5 changes: 5 additions & 0 deletions endpoints/catergories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import axios from '../services/api';

export function fetchCategories() {
return axios.get('/categories');
}
Empty file added endpoints/fancy.js
Empty file.
6 changes: 6 additions & 0 deletions endpoints/hungers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import axios from '../services/api';

export function fetchHungers() {
return axios.get('/hungers');
console.log('working');
}
11 changes: 11 additions & 0 deletions endpoints/meals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import axios from '../services/api';

export function fetchMealdetails() {
return axios.get('/meal/:id');
}

export function fetchFilteredMeals() {
return axios.get(
'/country/:country/city/:city/meals?minBudget=X&maxBudget=Y&id_hunger=Z&id_fancy=A&allergens=B&avoid_meals=C'
);
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"@react-navigation/native": "^6.1.1",
"@react-navigation/native-stack": "^6.9.7",
"@react-navigation/stack": "^6.3.10",
"@reduxjs/toolkit": "^1.9.1",
"axios": "^1.2.2",
"expo": "~47.0.12",
"expo-font": "~11.0.1",
"expo-status-bar": "~1.4.2",
Expand All @@ -29,7 +31,8 @@
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-vector-icons": "^9.2.0"
"react-native-vector-icons": "^9.2.0",
"react-redux": "^8.0.5"
},
"devDependencies": {
"@babel/core": "^7.20.12"
Expand Down
44 changes: 35 additions & 9 deletions screens/HowHungry.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import { Ionicons } from '@expo/vector-icons';
import React from 'react';
import { View, Text, Pressable } from 'react-native';
import React, { useEffect, useRef, useState } from 'react';
import { View, Text, Pressable, Button } from 'react-native';
import config from '../config';

import { fetchHungers } from '../endpoints/hungers';

export default function HowHungry({ navigation }) {
const [hungers, setHungers] = useState([]);

async function fetchHungersFromApi() {
const { data } = await fetchHungers();
setHungers(data);
console.log(data.i);
}

useEffect(() => {
fetchHungersFromApi();
}, []);

// const [name, setName] = useState('');

// // Creating a ref Object using useRef Hook
// const textRef = useRef(null);

// const onPressFunction = () => {
// const el2 = textRef.current;
// console.log(el2);
// };

return (
<View
style={{
Expand Down Expand Up @@ -45,15 +69,15 @@ export default function HowHungry({ navigation }) {
paddingLeft: config.deviceWidth * 0.1,
}}
>
<Text
{/* <Text
style={{
justifyContent: 'flex-start',
fontSize: 35,
color: '#1B463C',
}}
>
How hungry are {'\n'}you?
</Text>
</Text> */}
</View>

<View
Expand All @@ -66,6 +90,8 @@ export default function HowHungry({ navigation }) {
}}
>
<Pressable
// onPress={() => onPressFunction()}
onPress={() => onPressFunction()}
style={{
backgroundColor: '#D9E7E4',
marginTop: config.deviceHeight / 16,
Expand All @@ -77,10 +103,10 @@ export default function HowHungry({ navigation }) {
marginBottom: config.deviceHeight / 33,
}}
>
<Text style={{ color: '#1B463C' }}>Very Hungry</Text>
<Text style={{ color: '#1B463C' }}>{}</Text>
</Pressable>

<Pressable
{/* <Pressable
style={{
backgroundColor: '#D9E7E4',
alignItems: 'center',
Expand All @@ -107,10 +133,10 @@ export default function HowHungry({ navigation }) {
}}
>
<Text>Hungry</Text>
</Pressable>
</Pressable> */}
</View>

<View
{/* <View
style={{
alignItems: 'center',
}}
Expand All @@ -129,7 +155,7 @@ export default function HowHungry({ navigation }) {
>
<Text style={{ color: '#FFFFFF' }}>Continue</Text>
</Pressable>
</View>
</View> */}
</View>
);
}
5 changes: 5 additions & 0 deletions services/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import axios from 'axios';

export default axios.create({
baseURL: 'https://api-savourit.onrender.com/api/v1/en',
});
Loading

0 comments on commit ed04f39

Please sign in to comment.