forked from xiewang/react-native-emoticons
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tabDot.js
70 lines (56 loc) · 1.69 KB
/
tabDot.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
import React from 'react';
import {
Text,
View,
TouchableOpacity,
Navigator,
InteractionManager,
Platform,
DeviceEventEmitter
} from 'react-native';
import styles from './style';
import PropTypes from 'prop-types';
class TabBarDot extends React.Component {
constructor(props) {
super(props);
this._setAnimationValue = this._setAnimationValue.bind(this);
this.state = {
cameraPressed: false
};
this.tabComponent = [];
}
static propTypes = {
goToPage: PropTypes.func,
activeTab: PropTypes.number,
tabs: PropTypes.array,
};
componentDidMount() {
const the = this;
this._listener = this.props.scrollValue.addListener(this._setAnimationValue);
DeviceEventEmitter.addListener('tabChanged',(tab)=>{
the.props.goToPage(0);
});
}
_setAnimationValue({ value, }) {
}
_onIconPress(i) {
this.props.goToPage(i);
}
componentWillReceiveProps(){
}
componentDidUpdate(){
//this.props.goToPage(this.props.activeTab);
}
render() {
return (<View style={[styles.tabsDot, this.props.style, ]}>
{this.props.tabs.map((tab, i) => {
return <TouchableOpacity ref={(component) => this.tabComponent.push(component)}
key={tab} onPress={() => this._onIconPress(i)}
style={[styles.tabDot,{backgroundColor: (this.props.activeTab === i? '#ccc': '#fff')}]}>
<View style={styles.dot}></View>
</TouchableOpacity>;
})}
</View>);
}
}
export default TabBarDot;