-
Notifications
You must be signed in to change notification settings - Fork 860
Expand file tree
/
Copy pathFormulaeRender.ios.js
More file actions
60 lines (55 loc) · 1.21 KB
/
FormulaeRender.ios.js
File metadata and controls
60 lines (55 loc) · 1.21 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
'use strict';
import React, {
Component,
StyleSheet,
Text,
View,
TouchableHighlight
} from 'react-native';
export default class FormulaeRender extends Component {
Render () {
return (
<View style={styles.formulae}>
{this.state.displayFormulae.map(function(formula) {
return <TouchableHighlight style={getFormulaStyles(formula.operator)} onPress={this.handleClick.bind(this, formula)} underlayColor='#cdcdcd'>
<Text style={styles.text}>{formula.literal}</Text>
</TouchableHighlight>
}, this)}
</View>
);
}
}
var getFormulaStyles = function(operator) {
var button = {
basic: {
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center',
padding: 8,
marginLeft: 10
},
add: {
backgroundColor: '#fb96cf'
},
substract: {
backgroundColor: '#fcb064'
},
multiply: {
backgroundColor: '#68cef1'
},
divide: {
backgroundColor: '#cb7dc9'
}
};
return Object.assign(button.basic, button[operator]);
};
var styles = StyleSheet.create({
formulae: {
flexWrap: 'wrap',
alignItems: 'center',
justifyContent: 'center'
},
text: {
fontSize: 18
}
});