Skip to content

Commit

Permalink
Made some code shorter. Removed some inline styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muhsin committed Oct 16, 2018
1 parent 829e3ba commit e11886c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
13 changes: 3 additions & 10 deletions screens/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@ export default class HomeScreen extends React.Component {
</View>
<ScrollView
horizontal
scrollEventThrottle={10}
pagingEnabled
style={{ marginBottom: 10 }}
>
<Image
source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/polo-768x767.jpg' }} style={styles.sliderImage}
/>
<Image
source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/cap-768x768.jpg' }} style={styles.sliderImage}
/>
<Image
source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/sunglasses-768x768.jpg' }} style={styles.sliderImage}
/>
<Image source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/polo-768x767.jpg' }} style={styles.sliderImage} />
<Image source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/cap-768x768.jpg' }} style={styles.sliderImage} />
<Image source={{ uri: 'https://woocommerce-store.on-its-way.com/wp-content/uploads/2018/02/sunglasses-768x768.jpg' }} style={styles.sliderImage} />
</ScrollView>
<Button color="#05a5d1" title="SHOP" onPress={() => this.props.navigation.navigate("Products")} />
</ScrollView>
Expand Down
2 changes: 0 additions & 2 deletions screens/ProductsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,5 @@ const styles = StyleSheet.create({
loaderImage: {
width: 200,
height: 200,
alignItems: 'center',
justifyContent: 'center',
},
});
21 changes: 16 additions & 5 deletions screens/SingleProductScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export default class SingleProductScreen extends React.Component {
{cart => (
<ScrollView>
<Image style={styles.image} source={{ uri: product.images[0].src }} />
<Text style={styles.text}>{product.name} $ {product.price}</Text>
<View style={{ display: 'flex', flexDirection: 'row', padding: 10, marginLeft: 20, marginBottom: 20 }}>
<View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center' }}>
<Text style={styles.text}>{product.name} ${product.price}</Text>
<View style={styles.quantityCart}>
<View style={styles.quantity}>
<TouchableOpacity style={styles.decreaseButton} onPress={this.decreaseQuantity}>
<Text> - </Text>
</TouchableOpacity>
Expand Down Expand Up @@ -104,8 +104,19 @@ const styles = StyleSheet.create({
text: {
fontSize: 20,
paddingLeft: 20,
paddingBottom: 20,
textAlign: 'center'
paddingTop: 10,
paddingBottom: 10,
textAlign: 'center',
},
quantityCart: {
flexDirection: 'row',
padding: 10,
marginLeft: 20,
marginBottom: 20,
},
quantity: {
flexDirection: 'row',
justifyContent: 'center'
},
input: {
height: 40,
Expand Down

0 comments on commit e11886c

Please sign in to comment.