University of San Diego Creation of An App Using Expo Lab Report.
Question Description
Create an App using expo that does the following
– Displays 5 Students or Staff
– Displays their name, title(student/faculty/staff), and email
– Must use a Custom Component called “Person”
– Must use at least 1 piece of styling code
Submit a link to your expo snack
Include Images for each Student/Staff
This is an example that helps:
import React, { Component } from ‘react’;
import { Text, View, StyleSheet,ScrollView,Image } from ‘react-native’;
import { Constants } from ‘expo’;
const assets = {
egg: require(‘./images/egg.jpg’),
bagel: require(‘./images/bagel.jpg’),
taco: require(‘./images/taco.jpg’),
padthai: require(‘./images/pad-thai.jpg’),
pizza: require(‘./images/pizza.jpg’),
rendang: require(‘./images/rendang.jpg’),
icecream: require(‘./images/icecream.jpg’),
muffin: require(‘./images/muffin.jpg’),
lavacake: require(‘./images/lavacake.jpg’),
steak: require(‘./images/steak.jpg’),
chickenwings: require(‘./images/chickenwings.jpg’),
};
class FoodItem extends Component {
render() {
return (
<View style={styles.container} >
<Image style={styles.icon} source={assets[this.props.foodname]}/>
<Text style={styles.name}>{this.props.foodname}</Text>
<Text style={styles.description}>{this.props.description}</Text>
</View>
);
}
}
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<ScrollView>
<Text style={{fontSize:20}}>Scroll to see more Food</Text>
<FoodItem foodname=”egg” description=”A very fine collection of eggs” />
<FoodItem foodname=”taco” description=”Wonderful crunchy taco” />
<FoodItem foodname=”padthai” description=”Spicy and Sweet!” />
<FoodItem foodname=”pizza” description=”Food of the Gods!” />
<FoodItem foodname=”rendang” description=”Spicy beef curry from Indonesian” />
<FoodItem foodname=”icecream” description=”We all scream for icecream” />
<FoodItem foodname=”chickenwings” description=”Perfect for the ball game” />
<FoodItem foodname=”steak” description=”Medium Rare opening soon!” />
<FoodItem foodname=”lavacake” description=”Chocolate center soft cake” />
<FoodItem foodname=”muffin” description=”Blueberries are healthy right?” />
<FoodItem foodname=”bagel” description=”Round bread boiled and baked”/>
</ScrollView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: ‘row’,
alignItems: ‘center’,
backgroundColor: ‘#ffffff’,
justifyContent: ‘space-between’,
padding: 10,
height:120,
margin: 2,
borderWidth: 1,
},
icon:{
flex:.2,
resizeMode:”contain”
},
name:{
marginLeft:5,
flex:.4,
fontSize:30,
fontWeight:’bold’,
},
description:{
fontSize:20,
flex:.4,
fontStyle:’italic’,
}
});
University of San Diego Creation of An App Using Expo Lab Report