-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtemperaturechange.js
More file actions
39 lines (36 loc) · 1.09 KB
/
temperaturechange.js
File metadata and controls
39 lines (36 loc) · 1.09 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
import { StatusBar } from 'expo-status-bar';
import React, { useState }from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function AllText({title,NewState,setNewState}) {
function numUp() {
var num = NewState+1
setNewState(num)
}
const numbDown=()=> {
var num =NewState-1
setNewState(num)
}
const reset=()=> {
setNewState(0)
}
return (
<>
<View style={styles.container}>
<Text style={{color: 'black', fontSize: 30, fontStyle: 'italic', fontWeight: 'bold'}}>{title}</Text>
<Button title="+" onPress={()=>{numUp()}}/>
<Text style={{color: 'fuchsia', fontSize: 20, fontWeight: 'bold'}}> {NewState}°C {(NewState * 9/5) + 32 }°F </Text>
<Button title="-" onPress={()=>{numbDown()}}/>
<Button title="Reset" onPress={()=>{reset()}}/>
<StatusBar style="auto" />
</View>
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#00ffff',
alignItems: 'center',
justifyContent: 'space-evenly',
},
});