-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.react.js
72 lines (65 loc) · 1.43 KB
/
test.react.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
var MOCKED_MOVIES_DATA = [
{title: '标题', year: '2015', posters: {thumbnail: 'http://i.imgur.com/UePbdph.jpg'}},
];
import React, {
Component,
} from 'react';
import {
AppRegistry,
Image,
StyleSheet,
ViewPagerAndroid,
Text,
View,
TouchableHighlight,
} from 'react-native';
class TestReact extends Component {
render() {
var movie = MOCKED_MOVIES_DATA[0];
return (
//<View style={styles.container}>
// <Text>{movie.title}</Text>
// <Text>{movie.year}</Text>
// <Image
// source={{uri: movie.posters.thumbnail}}
// style={styles.thumbnail}/>
//</View>
<View style={{flex:1}}>
<TouchableHighlight
underlayColor="rgb(210, 230, 255)"
activeOpacity={0.5}
style={{borderRadius:8,padding:6,marginTop:5}}>
<Text style={{fontSize:16}}>点击我</Text>
</TouchableHighlight>
<ViewPagerAndroid
style={styles.pageStyle}
initialPage={0}>
<View style={{backgroundColor:'red'}}>
<Text>First Page.</Text>
</View>
<View style={{backgroundColor:'yellow'}}>
<Text>Second Page.</Text>
</View>
</ViewPagerAndroid>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF'
},
thumbnail: {
width: 53,
height: 81
},
pageStyle: {
alignItems: 'center',
padding: 20,
height: 200
}
});
AppRegistry.registerComponent('TestReact', () => TestReact);