Skip to content

Commit f37fa05

Browse files
committed
Scaffold a first try at a modal
1 parent f84d631 commit f37fa05

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

Screens/RecipesScreen.js

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { ScrollView, Text } from "react-native";
1+
import {
2+
ScrollView,
3+
Text,
4+
Modal,
5+
View,
6+
Pressable,
7+
StyleSheet,
8+
} from "react-native";
29
import RecipeCard from "../components/recipe-components/RecipeCard";
310
import { Constants } from "../util/constants";
411
import { useSelector, useDispatch } from "react-redux";
@@ -12,6 +19,17 @@ function RecipesScreen() {
1219
<ScrollView>
1320
<Text style={{ marginVertical: 20 }}>Recipes Screen</Text>
1421

22+
<Modal animationType="slide" transparent={true} visible={true}>
23+
<View style={styles.centeredView}>
24+
<View style={styles.modalView}>
25+
<Text style={styles.modalText}>This is the MODAL!</Text>
26+
<Pressable>
27+
<Text>Here is a pressable</Text>
28+
</Pressable>
29+
</View>
30+
</View>
31+
</Modal>
32+
1533
{ingredients.map((ingredient) => (
1634
<Text>{ingredient}</Text>
1735
))}
@@ -21,7 +39,7 @@ function RecipesScreen() {
2139
for (let i = 0; i < drinkIngredients.length; i++) {
2240
if (ingredients.indexOf(drinkIngredients[i]) < 0) {
2341
return;
24-
}
42+
}
2543
}
2644
return <RecipeCard>{drink.name}</RecipeCard>;
2745
})}
@@ -30,3 +48,32 @@ function RecipesScreen() {
3048
}
3149

3250
export default RecipesScreen;
51+
52+
const styles = StyleSheet.create({
53+
ceneteredView: {
54+
flex: 1,
55+
justifyContent: 'center',
56+
alignItems: 'center',
57+
marginTop: 22,
58+
},
59+
modalView: {
60+
margin: 20,
61+
marginTop: 280,
62+
backgroundColor: 'white',
63+
borderRadius: 20,
64+
padding: 35,
65+
alignItems: 'center',
66+
shadowColor: '#000',
67+
shadowOffset: {
68+
width: 0,
69+
height: 2,
70+
},
71+
shadowOpacity: 0.25,
72+
shadowRadius: 4,
73+
elevation: 5,
74+
},
75+
modalText: {
76+
color: 'green',
77+
fontSize: 12,
78+
}
79+
});

0 commit comments

Comments
 (0)