-
Notifications
You must be signed in to change notification settings - Fork 153
/
Home.js
80 lines (61 loc) · 1.68 KB
/
Home.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
/**
* Tmall 3c Fp Page
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var ItemList = require('./component/ItemList');
var Tabs = require('./component/Tabs');
var Cat = require('./component/Cat');
var Promotion = require('./component/Promotion');
var CloverSlider = require('./component/CloverSlider');
var {
ScrollView,
View,
} = React;
module.exports = React.createClass({
//object在组件被挂载之前调用。
getInitialState() {
return {
cateId : 0
};
},
//更新分类ID
handleUpdateList(cateId) {
this.setState({
cateId : cateId
})
},
//渲染头部
renderHeader() {
return (
<View style={{height : 25,backgroundColor : '#2964dd'}} />
);
},
//test
renderTest : function(){
return (
<TabBarIOS>
<TabBarIOS.Item title="React Native" selected={true} icon={require('image!cart')}>
<NavigatorIOS />
</TabBarIOS.Item>
</TabBarIOS>
);
},
render() {
var cateId = this.state.cateId;
return (
<View style={{flex : 1}}>
{/*{this.renderHeader()}*/}
<ScrollView stickyHeaderIndices={[4]} >
<CloverSlider />
<Cat />
<Promotion />
<View style={{height : 4, backgroundColor : '#F2F2F2'}} />
<Tabs updateCateItem={this.handleUpdateList} />
<ItemList cateId={cateId} />
</ScrollView>
</View>
);
}
});