channel 切换收起二级列表review草莓
Showing
1 changed file
with
8 additions
and
1 deletions
@@ -29,12 +29,19 @@ export default class CategoryList extends Component { | @@ -29,12 +29,19 @@ export default class CategoryList extends Component { | ||
29 | this.state = { | 29 | this.state = { |
30 | offsetx: 0, | 30 | offsetx: 0, |
31 | }; | 31 | }; |
32 | + this.cacheChannel=''; | ||
32 | } | 33 | } |
33 | componentWillMount() { | 34 | componentWillMount() { |
34 | // Animate creation | 35 | // Animate creation |
35 | LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); | 36 | LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); |
36 | } | 37 | } |
37 | - | 38 | + |
39 | + componentWillUpdate(nextProps,nextState){ | ||
40 | + if(this.cacheChannel!=nextProps.currentChannelId){ | ||
41 | + this.setState({offsetx:0}); | ||
42 | + this.cacheChannel=nextProps.currentChannelId; | ||
43 | + } | ||
44 | + } | ||
38 | _pressLeftRow(value,rowID){ | 45 | _pressLeftRow(value,rowID){ |
39 | this.props.pressLeftRow(value,rowID); | 46 | this.props.pressLeftRow(value,rowID); |
40 | if(rowID==this.props.currentCateId){ | 47 | if(rowID==this.props.currentCateId){ |
-
Please register or login to post a comment