-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
55 lines (51 loc) · 1.77 KB
/
App.js
File metadata and controls
55 lines (51 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import { View, Text, ScrollView, StyleSheet } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={styles.launchScreen}>
<View style={styles.topHalfContainer}>
<Text>Hello World</Text>
</View>
<ScrollView style={styles.bottomHalfContainer}>
<View style={styles.box}/>
<View style={styles.box}/>
<View style={styles.box}/>
<View style={styles.box}/>
<View style={styles.box}/>
</ScrollView>
</View>
);
}
}
// Establish some normalized standards of User Experience. Additionally if we use standard property names we can
// aggregate from DRY models using Object.assign.
// All boxes should use the same corner radius
const corner = { borderRadius: 8 }
// Establish a consistent container for half-screen layouts
const halfScreenContainer = {
flexDirection: 'column', // layout vertically from the top
flex: 1.0, // use only 50% of the screen, which for 2 sibling views means each are 100%
}
// The top half of the screen will hold the centered Hello World greeting
let greetingContainer = {
justifyContent: 'center', // vertical alignment
alignItems: 'center', // horizontal alignment
backgroundColor: 'whitesmoke',
}
Object.assign(greetingContainer, halfScreenContainer) // adopt the standard half-screen settings
// Assembly time.
const styles = StyleSheet.create({
launchScreen: {
flex: 1.0,
},
topHalfContainer: greetingContainer,
bottomHalfContainer: halfScreenContainer,
box: {
backgroundColor: 'orange',
width: '30%', // cool I can scale the layout for larger screens
height: 110,
margin: 12,
borderRadius: corner.borderRadius,
}
});