...
|
...
|
@@ -52,32 +52,42 @@ export default class BrandStoreFilter extends React.Component { |
|
|
};
|
|
|
}
|
|
|
|
|
|
shouldComponentUpdate(nextProps){
|
|
|
if (nextProps.selectID == this.props.selectID) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
_renderRow(rowData, sectionID, rowID) {
|
|
|
|
|
|
let colorStyle = rowID == this.state.selectedIndex ? {color: '#444444'} : {color: '#b0b0b0'};
|
|
|
|
|
|
return (
|
|
|
<TouchableOpacity onPress={() => {
|
|
|
let filters = this.state.filters;
|
|
|
let filter = this.state.filters[rowID];
|
|
|
if (this.state.selectedIndex == rowID) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
filter.isSelect = !filter.isSelect;
|
|
|
filters[rowID] = filter;
|
|
|
if (rowID != 3) {
|
|
|
this.setState({
|
|
|
selectedIndex: rowID,
|
|
|
filters,
|
|
|
});
|
|
|
}
|
|
|
this.props.onPressFilter && this.props.onPressFilter(rowID);
|
|
|
}}>
|
|
|
<View key={'row' + rowID} style={styles.rowContainer}>
|
|
|
<Text style={[styles.name, colorStyle]}>{rowData.name}</Text>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
<View style={{backgroundColor: 'white'}}>
|
|
|
<TouchableOpacity onPress={() => {
|
|
|
let filters = this.state.filters;
|
|
|
let filter = this.state.filters[rowID];
|
|
|
if (this.state.selectedIndex == rowID) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
filter.isSelect = !filter.isSelect;
|
|
|
filters[rowID] = filter;
|
|
|
if (rowID != 3) {
|
|
|
this.setState({
|
|
|
selectedIndex: rowID,
|
|
|
filters,
|
|
|
});
|
|
|
}
|
|
|
this.props.onPressFilter && this.props.onPressFilter(rowID);
|
|
|
}}>
|
|
|
<View key={'row' + rowID} style={styles.rowContainer}>
|
|
|
<Text style={[styles.name, colorStyle]}>{rowData.name}</Text>
|
|
|
</View>
|
|
|
</TouchableOpacity>
|
|
|
</View>
|
|
|
);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -90,12 +100,10 @@ export default class BrandStoreFilter extends React.Component { |
|
|
|
|
|
render() {
|
|
|
|
|
|
let {style} = this.props;
|
|
|
|
|
|
return (
|
|
|
<View style={[styles.container, style]}>
|
|
|
<View style={[styles.container]}>
|
|
|
<ListView
|
|
|
contentContainerStyle={[styles.contentContainer, style]}
|
|
|
contentContainerStyle={[styles.contentContainer]}
|
|
|
enableEmptySections={true}
|
|
|
dataSource={this.dataSource.cloneWithRows(this.state.filters)}
|
|
|
renderRow={this._renderRow}
|
...
|
...
|
|