...
|
...
|
@@ -23,6 +23,7 @@ import NewHotBannerListCell from './NewHotBannerListCell'; |
|
|
import BrandSearch from './search/BrandSearch';
|
|
|
import LoadingIndicator from '../../../common/components/LoadingIndicator';
|
|
|
import IndexListView from './IndexListView';
|
|
|
import {ScrollToIndex} from '../../utils/Utils';
|
|
|
|
|
|
export default class Brand extends Component {
|
|
|
constructor(props) {
|
...
|
...
|
@@ -31,7 +32,8 @@ export default class Brand extends Component { |
|
|
this.renderSectionHeader = this.renderSectionHeader.bind(this);
|
|
|
this.renderRow = this.renderRow.bind(this);
|
|
|
this.renderHeader = this.renderHeader.bind(this);
|
|
|
|
|
|
this.scrollToSection = this.scrollToSection.bind(this);
|
|
|
this.scrollData = [];
|
|
|
this.dataSource = new ListView.DataSource({
|
|
|
rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
|
|
|
sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),
|
...
|
...
|
@@ -47,6 +49,11 @@ export default class Brand extends Component { |
|
|
|
|
|
}
|
|
|
|
|
|
scrollToSection(sessionID){
|
|
|
let newSrc = ScrollToIndex(sessionID,this.scrollData);
|
|
|
this.listView.scrollTo({x: 0, y:443+newSrc , animated: false});
|
|
|
}
|
|
|
|
|
|
renderHeader(){
|
|
|
let data = this.props.reourceForBoy;
|
|
|
let brandFliter = this.props.brandFliter;
|
...
|
...
|
@@ -146,12 +153,14 @@ export default class Brand extends Component { |
|
|
let listDataSource;
|
|
|
let contentContainerStyle;
|
|
|
let renderSectionHeader = null;
|
|
|
let showIndexForListView = false;
|
|
|
|
|
|
if (brandFliter == 0) {
|
|
|
list = data?data.all_list:null;
|
|
|
listDataSource = list?this.dataSource.cloneWithRowsAndSections(list):null;
|
|
|
contentContainerStyle = styles.contentContainerOne;
|
|
|
renderSectionHeader = this.renderSectionHeader;
|
|
|
showIndexForListView = true;
|
|
|
} else if (brandFliter == 1) {
|
|
|
list = data?data.new_list:null;
|
|
|
listDataSource = list?this.dataSource.cloneWithRows(list):null;
|
...
|
...
|
@@ -165,12 +174,14 @@ export default class Brand extends Component { |
|
|
if (!list) {
|
|
|
return null;
|
|
|
}
|
|
|
this.scrollData = list;
|
|
|
|
|
|
return (
|
|
|
<View style={styles.container}>
|
|
|
<ChannelFliter selectID={channelFliter} onChannelPressFliter={this.props.onChannelPressFliter}/>
|
|
|
|
|
|
<ListView
|
|
|
ref={(ref)=>this.listView=ref}
|
|
|
contentContainerStyle={contentContainerStyle}
|
|
|
enableEmptySections={true}
|
|
|
dataSource={listDataSource}
|
...
|
...
|
@@ -180,6 +191,8 @@ export default class Brand extends Component { |
|
|
/>
|
|
|
|
|
|
<IndexListView dataSource={list}/>
|
|
|
{showIndexForListView?<IndexListView dataSource={list} onLetterPress={this.scrollToSection}/>: null}
|
|
|
{showSearch ? <BrandSearch style={styles.search} data={search}/> : null}
|
|
|
|
|
|
<LoadingIndicator
|
|
|
isVisible={isFetching}
|
...
|
...
|
|