TabContainer.js
2.28 KB
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
'use strict';
import React, {Component} from 'react';
import {StyleSheet, View} from "react-native";
import HomeContainer from './HomeContainer';
import DataContainer from './DataContainer';
import MessageContainer from './MessageContainer';
import MineContainer from './MineContainer';
import TabBottom from '../components/TabBottom';
import ScrollableTabView from 'react-native-scrollable-tab-view';
import ReactNative from "react-native";
const tabTitles = ['有货推手', '佣金', '消息', '我的'];
//默认图标
const tabIcon = [
require('../images/unselect_home.png'),
require('../images/unselect_data.png'),
require('../images/unselect_message.png'),
require('../images/unselect_mine.png'),
];
//选中图标
const tabSelectedIcon = [
require('../images/select_home.png'),
require('../images/select_data.png'),
require('../images/select_message.png'),
require('../images/select_mine.png'),
];
class TabContainer extends Component {
render() {
return (
<View style={styles.container}>
<ScrollableTabView
tabBarPosition='bottom'
locked={true}
scrollWithoutAnimation={true}
initialPage={this.props.tab_type ? parseInt(this.props.tab_type) : 0}
renderTabBar={() => <TabBottom
tabIconNames={tabIcon}
selectedTabIconNames={tabSelectedIcon}/>}
onChangeTab={(obj) => {
let params = {
TAB_ID: obj.i + 1
};
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_CPS_MAIN_TAB_C', params);
ReactNative.NativeModules.YH_CommonHelper.allianceUpdateTitle(tabTitles[obj.i]);
}
}
>
<HomeContainer/>
<DataContainer/>
<MessageContainer/>
<MineContainer/>
</ScrollableTabView>
</View>
)
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default TabContainer;