-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
53 lines (46 loc) · 1.1 KB
/
App.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
49
50
51
52
53
import React from "react";
import {View,Text,StyleSheet,TouchableOpacity} from "react-native"
import Torch from "react-native-torch"
export default class App extends React.Component{
onPressOn=()=>{
Torch.switchState(true)
}
onPressOff=()=>{
Torch.switchState(false)
}
render(){
return(
<View style={styles.container}>
<Text style={{fontSize:20,marginBottom:10}}>
A Simple Torch App
</Text>
<TouchableOpacity style={styles.button} onPress={this.onPressOn}>
<Text style={styles.text}> On </Text>
</TouchableOpacity>
<TouchableOpacity style={styles.button} onPress={this.onPressOff}>
<Text style={styles.text}> Off </Text>
</TouchableOpacity>
</View>
)
}
}
const styles=StyleSheet.create({
container:{
flex:1,
alignItems:"center",
justifyContent:"center"
},
text:{
color:"#FFF",
fontSize:15
},
button:{
height:60,
width:130,
marginTop:10,
borderRadius:10,
backgroundColor:"#161F3D",
justifyContent:"center",
alignItems:"center"
}
})