FiveStarView.js
983 Bytes
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
import React, {Component} from 'react';
import {
View,
Text,
Image,
} from 'react-native';
export default class FiveStarView extends Component {
constructor(props) {
super(props);
}
render() {
return(
<View
style={[{height:25/zoomW,width:width,flexDirection:'row',
justifyContent:'flex-start',alignItems:'center'}]}
>
{starMap.map((item,loop)=>{
return (
<TouchableWithoutFeedback key={loop} onPress={()=>NoDoublePress.onPress(()=>{
this.props.data.star = loop+1;
this.data = loop+1;
})}>
<Image source={this.props.data.star > loop?require('./imgs/star_on.png'):
require('./imgs/star_off.png')} style={{height: 20/zoomW,width: 20/zoomW,marginRight: 8/zoomW}} resizeMode={"contain"}/>
</TouchableWithoutFeedback>
)
})}
<Text style={{fontSize:setSpText2(12),color:'#999999'}}>
{this.logic.getStarStr(this.data)}
</Text>
</View>
)
}
}