Cleanup
22
app.json
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "ohome-app",
|
"name": "Ohome",
|
||||||
"slug": "ohome-app",
|
"slug": "ohome",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/logo512.png",
|
||||||
"splash": {
|
"splash": {
|
||||||
"image": "./assets/splash.png",
|
"image": "./assets/OhomeSplash.png",
|
||||||
"resizeMode": "contain",
|
"resizeMode": "contain",
|
||||||
"backgroundColor": "#ffffff"
|
"backgroundColor": "#f9f6ef"
|
||||||
},
|
},
|
||||||
"updates": {
|
"updates": {
|
||||||
"fallbackToCacheTimeout": 0
|
"fallbackToCacheTimeout": 0
|
||||||
@@ -17,16 +17,20 @@
|
|||||||
"**/*"
|
"**/*"
|
||||||
],
|
],
|
||||||
"ios": {
|
"ios": {
|
||||||
|
"bundleIdentifier": "codebenchers.ohome",
|
||||||
|
"buildNumber": "1.0.0",
|
||||||
"supportsTablet": true
|
"supportsTablet": true
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
|
"package": "codebenchers.ohome",
|
||||||
|
"versionCode": 1,
|
||||||
"adaptiveIcon": {
|
"adaptiveIcon": {
|
||||||
"foregroundImage": "./assets/adaptive-icon.png",
|
"foregroundImage": "./assets/logo512.png",
|
||||||
"backgroundColor": "#FFFFFF"
|
"backgroundColor": "#f9f6ef"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
"favicon": "./assets/favicon.png"
|
"favicon": "./assets/logo192.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
assets/OhomeSplash.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
assets/icon.png
|
Before Width: | Height: | Size: 22 KiB |
BIN
assets/logo192.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/logo512.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 46 KiB |
21
src/App.js
@@ -11,10 +11,11 @@ import Recipe from './pages/recipes/Recipe';
|
|||||||
|
|
||||||
import theme from './styles/theme';
|
import theme from './styles/theme';
|
||||||
//dependencies
|
//dependencies
|
||||||
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
//navigation
|
//navigation
|
||||||
import { NavigationContainer } from '@react-navigation/native';
|
import { NavigationContainer } from '@react-navigation/native';
|
||||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||||
|
import { useNavigation } from '@react-navigation/core';
|
||||||
|
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
@@ -38,11 +39,21 @@ function App() {
|
|||||||
backgroundColor: theme.colors.dp00 + 'bb'
|
backgroundColor: theme.colors.dp00 + 'bb'
|
||||||
}, //COLORS.dp08
|
}, //COLORS.dp08
|
||||||
headerShadowVisible: false,
|
headerShadowVisible: false,
|
||||||
headerTintColor: theme.colors.textW0,
|
headerTintColor: theme.colors.textW1,
|
||||||
headerTitleStyle: { fontSize: 32 },
|
headerTitleStyle: { fontSize: 32, fontWeight: 'bold' },
|
||||||
cardOverlayEnabled: true,
|
cardOverlayEnabled: true,
|
||||||
headerTransparent: true,
|
headerTransparent: true,
|
||||||
}}>
|
headerLeft: () => {
|
||||||
|
const navigation = useNavigation()
|
||||||
|
return (
|
||||||
|
< MaterialCommunityIcons style={{marginLeft: -5, marginRight: 15, marginTop: 5}} name="arrow-left" size={40} color={theme.colors.textW2}
|
||||||
|
onPress={() => navigation.goBack()}
|
||||||
|
>
|
||||||
|
</MaterialCommunityIcons>)}
|
||||||
|
}}
|
||||||
|
options={{
|
||||||
|
}}>
|
||||||
|
|
||||||
<Stack.Screen name="Home" component={HomePage} options={{
|
<Stack.Screen name="Home" component={HomePage} options={{
|
||||||
headerLeft: () => (
|
headerLeft: () => (
|
||||||
< TouchableOpacity
|
< TouchableOpacity
|
||||||
@@ -54,7 +65,7 @@ function App() {
|
|||||||
<Stack.Screen name="Groceries" component={GroceryListPage} />
|
<Stack.Screen name="Groceries" component={GroceryListPage} />
|
||||||
<Stack.Screen name="Recipes" component={RecipePage} />
|
<Stack.Screen name="Recipes" component={RecipePage} />
|
||||||
<Stack.Screen name="Recipe" component={Recipe} />
|
<Stack.Screen name="Recipe" component={Recipe} />
|
||||||
<Stack.Screen name="AddRecipe" component={AddRecipe} />
|
<Stack.Screen name="Add a recipe" component={AddRecipe} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ export default React.memo((props) => {
|
|||||||
const [modalListVisible, setModalListVisible] = useState(false);
|
const [modalListVisible, setModalListVisible] = useState(false);
|
||||||
|
|
||||||
const HandleAnimation = (event) => {
|
const HandleAnimation = (event) => {
|
||||||
|
const height = event.nativeEvent.layout.height
|
||||||
LayoutAnimation.configureNext(LayoutAnimation.create(200, 'easeInEaseOut', 'opacity'))
|
LayoutAnimation.configureNext(LayoutAnimation.create(200, 'easeInEaseOut', 'opacity'))
|
||||||
setHeight(event.nativeEvent.layout.height)
|
setHeight(height)
|
||||||
// console.log("height changed: ", event.nativeEvent.layout.height)
|
// console.log(height)
|
||||||
}
|
}
|
||||||
|
|
||||||
const removeList = () => {
|
const removeList = () => {
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ const GroceryCard = (props) => {
|
|||||||
return (
|
return (
|
||||||
<WrapperCard onPress={() => navigation.navigate('Groceries')}>
|
<WrapperCard onPress={() => navigation.navigate('Groceries')}>
|
||||||
<TextCard>Groceries</TextCard>
|
<TextCard>Groceries</TextCard>
|
||||||
<IconCoffee/>
|
<IconCoffee />
|
||||||
<View style={{ height: 100, width: '100%' }} />
|
|
||||||
</WrapperCard>
|
</WrapperCard>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,14 +31,19 @@ export const TextCard = styled(Text)`
|
|||||||
color: ${props => props.theme.colors.textW2};
|
color: ${props => props.theme.colors.textW2};
|
||||||
background-color: #0003;
|
background-color: #0003;
|
||||||
`
|
`
|
||||||
const Coffee = () => <MaterialCommunityIcons name="coffee" color={theme.colors.primaryVar} size={50} />
|
|
||||||
|
|
||||||
export const IconCoffee = styled(Coffee)`
|
export const IconCoffee = styled(MaterialCommunityIcons).attrs({
|
||||||
margin-top: 15px;
|
name: 'coffee'
|
||||||
|
})`
|
||||||
|
color: ${props => props.theme.colors.primaryVar};
|
||||||
|
font-size: 70px;
|
||||||
|
margin-top: 10px;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Meal = () => <MaterialCommunityIcons name="noodles" color={theme.colors.primaryVar} size={50} />
|
export const IconRecipe = styled(MaterialCommunityIcons).attrs({
|
||||||
|
name: 'noodles'
|
||||||
export const IconRecipe = styled(Meal)`
|
})`
|
||||||
margin-top: 15px;
|
color: ${props => props.theme.colors.primaryVar};
|
||||||
|
font-size: 70px;
|
||||||
|
margin-top: 10px;
|
||||||
`
|
`
|
||||||
@@ -17,7 +17,7 @@ import { TouchableOpacity } from "react-native-gesture-handler";
|
|||||||
export const AddRecipeButton = () => {
|
export const AddRecipeButton = () => {
|
||||||
let navigation = useNavigation()
|
let navigation = useNavigation()
|
||||||
return (
|
return (
|
||||||
<WrapperAddRecipe onPress={() => navigation.navigate('AddRecipe', {id: ""})}>
|
<WrapperAddRecipe onPress={() => navigation.navigate('Add a recipe', {id: ""})}>
|
||||||
<IconPlus />
|
<IconPlus />
|
||||||
</WrapperAddRecipe>
|
</WrapperAddRecipe>
|
||||||
)
|
)
|
||||||
@@ -59,7 +59,7 @@ export const OptionsButtonRecipe = (props) => {
|
|||||||
<TouchableOpacity onPress={() => handleRemove()} >
|
<TouchableOpacity onPress={() => handleRemove()} >
|
||||||
<IconRemove />
|
<IconRemove />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity onPress={() => navigation.navigate("AddRecipe", { id: props.id })} >
|
<TouchableOpacity onPress={() => navigation.navigate("Add a recipe", { id: props.id })} >
|
||||||
<IconEdit />
|
<IconEdit />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</WrapperOptions>
|
</WrapperOptions>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { OptionsButtonRecipe, AddIngredientsButton } from "../../components/reci
|
|||||||
import { ScrollView, Text, View } from "react-native"
|
import { ScrollView, Text, View } from "react-native"
|
||||||
import HeaderPadding from "../../components/Header"
|
import HeaderPadding from "../../components/Header"
|
||||||
|
|
||||||
const Recipe = ({route, navigation}) => {
|
const Recipe = ({ route, navigation }) => {
|
||||||
const id = route.params.id
|
const id = route.params.id
|
||||||
const recipe = useSelector(state => findRecipeById(state, id))
|
const recipe = useSelector(state => findRecipeById(state, id))
|
||||||
const IngredientList = recipe.ingredients.map((ingredient, index) => {
|
const IngredientList = recipe.ingredients.map((ingredient, index) => {
|
||||||
@@ -28,17 +28,17 @@ const Recipe = ({route, navigation}) => {
|
|||||||
|
|
||||||
React.useLayoutEffect(() => {
|
React.useLayoutEffect(() => {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<OptionsButtonRecipe id={id} />
|
<OptionsButtonRecipe id={id} />
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}, [navigation]);
|
}, [navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<HeaderPadding/>
|
|
||||||
{recipe.image != "" && <StyledImage source={{ uri: recipe.image }} />}
|
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
|
<HeaderPadding />
|
||||||
|
{recipe.image != "" && <StyledImage source={{ uri: recipe.image }} />}
|
||||||
<Wrapper >
|
<Wrapper >
|
||||||
<WrapperRecipe>
|
<WrapperRecipe>
|
||||||
<Title>{recipe.name}</Title>
|
<Title>{recipe.name}</Title>
|
||||||
|
|||||||