Authored by 于良

浏览记录优化 review by 盖剑秋

... ... @@ -24,7 +24,7 @@ export default class Browse extends Component {
super(props);
this.renderRow = this.renderRow.bind(this);
this.renderHeader = this.renderHeader.bind(this);
this.renderSectionHeader = this.renderSectionHeader.bind(this);
this.handleScroll = this.handleScroll.bind(this);
this.onOpen = this.onOpen.bind(this);
this.onClose = this.onClose.bind(this);
... ... @@ -35,6 +35,7 @@ export default class Browse extends Component {
this.state = {
currentlyOpenSwipeable: null,
isSwiping: false,
};
this.listView = null;
... ... @@ -98,6 +99,8 @@ export default class Browse extends Component {
rightButtonWidth={70}
onRightButtonsOpenRelease={this.onOpen}
onRightButtonsCloseRelease={this.onClose}
onSwipeStart={() => this.setState({isSwiping: true})}
onSwipeRelease={() => this.setState({isSwiping: false})}
>
<ProductCell
key={'row' + rowID}
... ... @@ -109,7 +112,7 @@ export default class Browse extends Component {
);
}
renderHeader() {
renderSectionHeader() {
let {isFetching, selectedProductList, categoryList, selectedCategoryIndex} = this.props.data;
return (
<CategorySelector
... ... @@ -135,12 +138,14 @@ export default class Browse extends Component {
ref={(c) => {
this.listView = c;
}}
scrollEnabled={!this.state.isSwiping}
enableEmptySections={true}
dataSource={this.dataSource.cloneWithRows(selectedProductList.toArray())}
renderRow={this.renderRow}
renderHeader={this.renderHeader}
renderSectionHeader={this.renderSectionHeader}
onScroll={this.handleScroll}
/> : null}
{showEmpty ? <NoDataView type={'browse'} onPressGuangGuang={this.props.onPressGuangGuang}/> : null}
<LoadingIndicator
isVisible={isLoading}
... ...
... ... @@ -37,6 +37,7 @@ export default class Product extends Component {
this.state = {
currentlyOpenSwipeable: null,
isSwiping: false,
};
this.listView = null;
... ... @@ -117,6 +118,8 @@ export default class Product extends Component {
rightButtonWidth={70}
onRightButtonsOpenRelease={this.onOpen}
onRightButtonsCloseRelease={this.onClose}
onSwipeStart={() => this.setState({isSwiping: true})}
onSwipeRelease={() => this.setState({isSwiping: false})}
>
<ProductCell
key={'row' + rowID}
... ... @@ -245,6 +248,7 @@ export default class Product extends Component {
onScroll={this.handleScroll}
renderFooter={this.renderFooter}
bounces={dataArray.length > 0}
scrollEnabled={!this.state.isSwiping}
/> : null}
<LoadingIndicator
... ...
... ... @@ -99,7 +99,9 @@ class BrandContainer extends Component {
if (!brand) {
return;
}
brand = brand.toJS();
brand.id = brand.brand_id;
ReactNative.NativeModules.YH_CommonHelper.pushBrandVC(brand);
}
... ...