-
Notifications
You must be signed in to change notification settings - Fork 860
Expand file tree
/
Copy pathKeyRender.ios.js
More file actions
147 lines (141 loc) · 3.27 KB
/
KeyRender.ios.js
File metadata and controls
147 lines (141 loc) · 3.27 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
'use strict';
import React, {
Component,
StyleSheet,
Text,
View,
TouchableHighlight
} from 'react-native';
export default class KeyRender extends Component {
Render () {
if(this.props.keyType === 'number') {
return (
<View style={styles.keyNumber}>
<TouchableHighlight style={styles.button} onPress={this.handleClick} underlayColor='#cdcdcd'>
<Text style={styles.textButton}>
{this.props.keySymbol}
</Text>
</TouchableHighlight>
</View>
);
} else if(this.props.keyType === 'operator') {
return (
<View style={styles.keyOperator}>
<TouchableHighlight style={getOperatorStyles(this.props.keyValue)} onPress={this.handleClick} underlayColor='#cdcdcd'>
<Text style={styles.textButtonOperator}>
{this.props.keySymbol}
</Text>
</TouchableHighlight>
</View>
);
} else if(this.props.keyType === 'action') {
return (
<View style={styles.keyAction}>
<TouchableHighlight style={getActionStyles(this.props.keyValue)} onPress={this.handleClick} underlayColor='#cdcdcd'>
<Text style={getActionButtonStyles(this.props.keyValue)}>
{this.props.keySymbol}
</Text>
</TouchableHighlight>
</View>
);
}
}
}
var getOperatorStyles = function(classOperation) {
var buttonOperator = {
basic: {
height: 50,
width: 50,
borderRadius: 25,
alignItems: 'center',
justifyContent: 'center'
},
add: {
backgroundColor: '#fb96cf',
paddingBottom: 3
},
substract: {
backgroundColor: '#fcb064',
paddingBottom: 3
},
multiply: {
backgroundColor: '#68cef1',
paddingBottom: 3
},
divide: {
backgroundColor: '#cb7dc9',
paddingBottom: 3
}
};
return Object.assign(buttonOperator.basic, buttonOperator[classOperation]);
};
var getActionStyles = function(classOperation) {
var buttonAction = {
basic: {
flex: 1,
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center'
},
back: {
paddingBottom: 1,
borderColor: '#d68086',
borderWidth: 1
},
equal: {
paddingBottom: 1,
borderColor: '#9ed8a6',
borderWidth: 1
}
};
return Object.assign(buttonAction.basic, buttonAction[classOperation]);
};
var getActionButtonStyles = function(classOperation) {
var buttonText = {
basic: {
fontSize: 25,
fontWeight: '200'
},
back: {
paddingBottom: 3,
color: '#d68086'
},
equal: {
paddingBottom: 3,
color: '#9ed8a6'
}
};
return Object.assign(buttonText.basic, buttonText[classOperation]);
};
var styles = StyleSheet.create({
keyNumber: {
flex: 1,
borderColor: '#f8f8f8',
borderWidth: 1
},
keyOperator: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
},
keyAction: {
flex: 1,
padding: 10
},
button: {
flex: 1,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center'
},
textButton: {
color: '#919191',
fontSize: 20,
fontWeight: '400'
},
textButtonOperator: {
color: 'white',
fontSize: 20,
fontWeight: '600'
}
});