-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
119 lines (103 loc) · 3.04 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
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
import React from 'react';
import { StyleSheet, Text, View, Button, TextInput } from 'react-native';
import { Speech } from 'expo';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
name: null,
myInterval: null,
};
}
giveAttention = () => {
clearInterval(this.state.myInterval);
this.state.myInterval;
let myInterval = setInterval(this.saySomethin, 5000);
this.setState({ myInterval })
}
breakUp = () => {
clearInterval(this.state.myInterval);
let text = `Alright bye ${this.state.name}`;
let options = { language: 'en', pitch: 3.0, rate: 0.8, };
Speech.speak(text, options);
}
saySomethin = () => {
let needySayings = ['Spend time with me', 'Where you at', 'I need you', ' I want you', 'I will break up with you ', 'You doing okay'];
let text;
if (this.state.name) { text = this.state.name + ', ' + needySayings[Math.floor(Math.random() * 5)] }
else { text = needySayings[Math.floor(Math.random() * 5)] }
let options = { language: 'en', pitch: 3.0, rate: 0.8, };
Speech.speak(text, options)
}
changeName = (e) => {
e.preventDefault();
let name = e.target.value;
this.setState({ name })
}
componentDidMount = () => {
let myInterval = setInterval(this.saySomethin, 100000);
this.setState({ myInterval })
}
render() {
return (
<View style={styles.container}>
<Text style={styles.header}>
Insecure Phone
</Text>
<TextInput
style={styles.textInput}
onChangeText={(name) => this.setState({ name })}
value={this.state.name}
placeholder="Place your name here"
/>
<Text>
Your name: {this.state.name}
</Text>
<Text style={styles.button1} onPress={this.giveAttention}>
Give Them Attention
</Text>
{/* <Button onPress={this.giveAttention} title="Give Attention" /> */}
<Button onPress={this.breakUp} title="Break Up With Them" />
</View >
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
header: {
fontSize: 30,
},
textInput: {
height: 40,
borderColor: 'black',
borderRadius: 10,
borderWidth: 2,
padding: 10,
margin: 10,
},
button1: {
// width: 200,
// height: 200 - 200/10,
lineHeight: 200,
// alignItems: 'center',
borderColor: 'black',
borderRadius: 100,
borderWidth: 20,
backgroundColor: '#f74d4d',
fontSize: 20,
color: 'white',
// background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f74d4d), color-stop(100%, #f86569)),
// background-image: -moz-gradient(linear, left top, left bottom, color-stop(0%,'#f74d4d'), color-stop(100%,#f86569)),
// box-shadow: 0 15px #e24f4f,
// &:active {
// box-shadow: 0 0 #e24f4f,
// .translate(0px, 15px),
// .transition( 0.1s all ease-out),
// }
}
});