修复品类点击直接掉转的问题
review 陈林
Showing
1 changed file
with
6 additions
and
0 deletions
@@ -43,7 +43,12 @@ export default class CategoryList extends Component { | @@ -43,7 +43,12 @@ export default class CategoryList extends Component { | ||
43 | } | 43 | } |
44 | } | 44 | } |
45 | _pressLeftRow(value,rowID){ | 45 | _pressLeftRow(value,rowID){ |
46 | + if(value.sub.length==1){ | ||
47 | + this.props.pressSubCateRow(value.sub[0], 0); | ||
48 | + return; | ||
49 | + } | ||
46 | this.props.pressLeftRow(value,rowID); | 50 | this.props.pressLeftRow(value,rowID); |
51 | + this.refs.subCategoryList && this.refs.subCategoryList.scrollTo({x: 0, y: 0, animated: false}); | ||
47 | if(rowID==this.props.currentCateId){ | 52 | if(rowID==this.props.currentCateId){ |
48 | LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); | 53 | LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); |
49 | if(this.state.offsetx<0){ | 54 | if(this.state.offsetx<0){ |
@@ -129,6 +134,7 @@ export default class CategoryList extends Component { | @@ -129,6 +134,7 @@ export default class CategoryList extends Component { | ||
129 | scrollsToTop={false} | 134 | scrollsToTop={false} |
130 | /> | 135 | /> |
131 | <ListView | 136 | <ListView |
137 | + ref='subCategoryList' | ||
132 | style={[styles.subContentContainer, {marginLeft: this.state.offsetx}]} | 138 | style={[styles.subContentContainer, {marginLeft: this.state.offsetx}]} |
133 | dataSource={this.dataSource.cloneWithRows(subCateList)} | 139 | dataSource={this.dataSource.cloneWithRows(subCateList)} |
134 | enableEmptySections={true} | 140 | enableEmptySections={true} |
-
Please register or login to post a comment