-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.android_state.js
39 lines (33 loc) · 1014 Bytes
/
index.android_state.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
import React, { Component } from 'react';
import { AppRegistry, Text, View} from 'react-native';
class Blink extends Component {
constructor(props) {
super(props);
this.state = {showText: true};
// Toggle the state every second
setInterval (() => {
this.setState(previousState => {
return {showText: !previousState.showText};
});
},1000);
}
render() {
let display = this.state.showText ? this.props.text : ' ';
return (
<Text>{display}</Text>
);
}
}
export default class BlinkApp extends Component {
render () {
return (
<View>
<Blink text='I love to blink'/>
<Blink text='yes blinking is so great'/>
<Blink text='Why did they ever take this out of HTML' />
<Blink text='Look at me look at me look at me' />
</View>
);
}
}
AppRegistry.registerComponent('AwesomeProject',() => BlinkApp);