-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcalculatordisplay.js
48 lines (45 loc) · 1.01 KB
/
calculatordisplay.js
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
import React, { Component } from 'react'
import { View, SafeAreaView, Text, StyleSheet } from 'react-native'
import colors from '../utils/colors';
const Display = ({ state }) => (
<View style={styles.container}>
<SafeAreaView style={styles.safe}>
<Text
style={styles.display}
adjustsFontSizeToFit
numberOfLines={1}
>{state.display}</Text>
{ state.result !== '' &&
<Text
style={styles.result}
adjustsFontSizeToFit
numberOfLines={1}
>{state.result}</Text>
}
</SafeAreaView>
</View>
)
const styles = StyleSheet.create({
container: {
backgroundColor: colors.dark,
flex: 1,
justifyContent: 'space-around',
paddingHorizontal: 25,
},
safe: {
flex: 1,
justifyContent: 'space-around',
},
display: {
textAlign: 'right',
fontWeight: 'bold',
color: colors.white,
fontSize: 45,
},
result: {
textAlign: 'right',
color: colors.white,
fontSize: 30,
},
})
export default Display;