-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
129 lines (121 loc) · 2.73 KB
/
Copy pathApp.js
File metadata and controls
129 lines (121 loc) · 2.73 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* KARMA v.1
* author: patrisor, alkozma
*/
/**
* Importing different libraries
*/
import React, {Component} from 'react';
import {TouchableOpacity, Alert, Button, Platform, StyleSheet, Text, View} from 'react-native';
/**
* Header: Arrow function which is stored in a parameterless function declaration
* TODO: Insert Karma Logo
* Color: #00FFFF
*/
export const Header = () => (
<View style={styles.header}>
<Text style={styles.text}>KARMA v.1</Text>
</View>
);
// TODO: Logic to keep iterating a number by 1 then converting it into a string and back
export const onPressButton = () => {
this.setState({number: this.state.number + 1})
}
/**
* My main Class
*/
type Props = {};
export default class App extends Component<Props> {
// Constructor
constructor() {
super()
this.state = {
number: 0
}
}
// Main Function
render() {
return [
// Header
<View>
<Header>{}</Header>
</View>,
// Button
<TouchableOpacity style={styles.button}>
<Text></Text>
</TouchableOpacity>,
// Footer
<View style={styles.footer}>{}</View>,
// Text on top of the screen
<View style={styles.counterView}>
<Text style={styles.counter}>{this.state.number.toString()}</Text>
</View>
];
/* TODO: Convert what you have above (render() returns an array of individually created
objects) into this format for return \/
return (
<View style={styles.container}>
// Header
<View>
<Header>{}</Header>
</View>
// Button
<View style={styles.button}>
<Button title="KARMA"/>
</View>
// Footer
<View style={styles.footer}>{}</View>
</View>
);
*/
}
}
/**
* Edit the types of styles available for the current state of your objects
* iPhone -> height: 76, marginTop: 24
* Android -> height: 100, marginTop: 0
*/
const styles = StyleSheet.create({
header: {
height: Platform.OS === 'android' ? 76 : 100,
marginTop: Platform.OS === 'ios' ? 0 : 4,
backgroundColor: '#00ffff',
alignItems: 'center',
justifyContent: 'center'
},
footer: {
flex: 1,
width: '100%',
height: 30,
backgroundColor: '#00ffff',
position: 'absolute',
bottom: 0
},
text: {
color: '#ffffff',
fontSize: 35,
top: 25
},
button: {
// Attributes
backgroundColor: '#00ffff',
borderColor: '#00B3B3',
borderWidth: 5,
height: 150,
width: 150,
// Use absolute position to put objects wherever you want
position: 'absolute',
bottom: 50,
alignSelf: 'center',
},
counterView: {
// Position
alignSelf: 'center',
top: 25
},
counter: {
color: '#00ffff',
fontSize: 50,
fontWeight: 'bold',
}
});