forked from alibaba/rax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewDemo.js
98 lines (92 loc) · 2.89 KB
/
ViewDemo.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
import {createElement, Component} from 'rax';
import View from 'rax-view';
import Text from 'rax-text';
import Image from 'rax-image';
import Link from 'rax-link';
import TextInput from 'rax-textinput';
import Button from 'rax-button';
import Switch from 'rax-switch';
import ScrollView from 'rax-scrollview';
import TouchableWithoutFeedback from 'rax-touchable';
class ViewDemo extends Component {
state = {
showBorder: true
};
_handlePress = () => {
this.setState({showBorder: !this.state.showBorder});
};
render() {
return (
<View>
<View style={styles.container}>
<TouchableWithoutFeedback onPress={this._handlePress}>
<View>
<View style={{
borderWidth: 2,
borderStyle: this.state.showBorder ? 'dashed' : 'solid',
padding: 10
}}>
<Text style={{fontSize: 22}}>
Dashed border style
</Text>
</View>
<View style={{
marginTop: 10,
borderWidth: 2,
borderRadius: 10,
borderStyle: this.state.showBorder ? 'dotted' : 'solid',
padding: 10
}}>
<Text style={{fontSize: 22}}>
Dotted border style
</Text>
</View>
</View>
</TouchableWithoutFeedback>
</View>
<View style={styles.container}>
<View style={{opacity: 0}}><Text>Opacity 0</Text></View>
<View style={{opacity: 0.1}}><Text>Opacity 0.1</Text></View>
<View style={{opacity: 0.3}}><Text>Opacity 0.3</Text></View>
<View style={{opacity: 0.5}}><Text>Opacity 0.5</Text></View>
<View style={{opacity: 0.7}}><Text>Opacity 0.7</Text></View>
<View style={{opacity: 0.9}}><Text>Opacity 0.9</Text></View>
<View style={{opacity: 1}}><Text>Opacity 1</Text></View>
</View>
<View style={styles.container}>
<View style={[styles.box, {padding: 10}]}>
<Text style={{fontSize: 22}}>10rem padding</Text>
</View>
<View style={[styles.box, {margin: 10}]}>
<Text style={{fontSize: 22}}>10rem margin</Text>
</View>
<View style={[styles.box, {margin: 10, padding: 10, alignSelf: 'flex-start'}]}>
<Text style={{fontSize: 22}}>
10rem margin and padding,
</Text>
<Text style={{fontSize: 22}}>
widthAutonomous=true
</Text>
</View>
</View>
</View>
);
}
}
let styles = {
container: {
padding: 20,
borderStyle: 'solid',
borderColor: '#dddddd',
borderWidth: 1,
marginLeft: 20,
marginRight: 20,
marginBottom: 10,
},
box: {
backgroundColor: '#527FE4',
borderColor: '#000033',
borderWidth: 1,
},
};
export default ViewDemo;