-
-
Notifications
You must be signed in to change notification settings - Fork 361
/
testprog.js
69 lines (65 loc) · 1.67 KB
/
testprog.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
import React, { Component } from 'react';
import {
App,
AppRegistry,
Window,
View,
Text,
TouchableWithoutFeedback,
TouchableOpacity,
TouchableHighlight,
Button,
Image,
TextInput,
Picker,
setBackend,
} from './bin/';
setBackend('qt');
class Example extends Component {
state = {
test: 'dsdasdsa',
a: true,
mouseState: 'idle',
x: 50,
y: 50,
};
componentDidMount() {
//setTimeout(() => this.setState({ test: "dsawewwww" }), 3000);
//setTimeout(() => this.setState({ a: false }), 3000);
}
render() {
return (
<App>
{/*<Window style={{ height: 400, width: 500 }}>*/}
<Window
style={{ height: '25%', width: '25%', backgroundColor: 'blue' }}
>
<View
onMouseEnter={() => this.setState({ mouseState: 'MOUSE ENTERED' })}
onMouseLeave={() => this.setState({ mouseState: 'MOUSE LEFT' })}
onMouseMove={event => this.setState(event.point)}
style={{ height: '50%', width: '100%', backgroundColor: 'green' }}
>
<Button
style={{ backgroundColor: 'white' }}
onPress={() => console.log('PRessed')}
title="My button"
/>
<Text>{`Mouse state: ${this.state.mouseState}`}</Text>
<View
style={{
width: 40,
height: 40,
backgroundColor: 'black',
position: 'absolute',
top: this.state.y,
left: this.state.x,
}}
></View>
</View>
</Window>
</App>
);
}
}
AppRegistry.registerComponent('Test', <Example />);