|
@@ -14,6 +14,7 @@ import ReactNative, { |
|
@@ -14,6 +14,7 @@ import ReactNative, { |
14
|
Platform,
|
14
|
Platform,
|
15
|
RefreshControl,
|
15
|
RefreshControl,
|
16
|
} from 'react-native';
|
16
|
} from 'react-native';
|
|
|
17
|
+import TimerMixin from 'react-timer-mixin';
|
17
|
import Immutable, {Map} from 'immutable';
|
18
|
import Immutable, {Map} from 'immutable';
|
18
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
19
|
import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
|
19
|
import YH_SortView from '../../../common/components/YH_SortView';
|
20
|
import YH_SortView from '../../../common/components/YH_SortView';
|
|
@@ -84,6 +85,11 @@ export default class Home extends Component { |
|
@@ -84,6 +85,11 @@ export default class Home extends Component { |
84
|
}
|
85
|
}
|
85
|
}
|
86
|
}
|
86
|
|
87
|
|
|
|
88
|
+ componentWillUnmount() {
|
|
|
89
|
+ this.requestAnimationFrame && TimerMixin.cancelAnimationFrame(this.requestAnimationFrame);
|
|
|
90
|
+ }
|
|
|
91
|
+
|
|
|
92
|
+
|
87
|
trigggePullToRefresh(changeChannel=false) {
|
93
|
trigggePullToRefresh(changeChannel=false) {
|
88
|
let data = this._currentChannelData();
|
94
|
let data = this._currentChannelData();
|
89
|
if (changeChannel) {
|
95
|
if (changeChannel) {
|
|
@@ -150,8 +156,8 @@ export default class Home extends Component { |
|
@@ -150,8 +156,8 @@ export default class Home extends Component { |
150
|
<DivideImage/>
|
156
|
<DivideImage/>
|
151
|
<SingleImage
|
157
|
<SingleImage
|
152
|
data={rowData}
|
158
|
data={rowData}
|
153
|
- onPressSlideItem={this.props.onPressSlideItem}
|
|
|
154
|
- onPressTitleMore={this.props.onPressTitleMore}
|
159
|
+ onPressSlideItem={this.props.onPressChangeChannel}
|
|
|
160
|
+ onPressTitleMore={this.props.onPressChangeChannel}
|
155
|
/>
|
161
|
/>
|
156
|
</View>
|
162
|
</View>
|
157
|
);
|
163
|
);
|
|
@@ -444,15 +450,22 @@ export default class Home extends Component { |
|
@@ -444,15 +450,22 @@ export default class Home extends Component { |
444
|
|
450
|
|
445
|
_onScroll(event) {
|
451
|
_onScroll(event) {
|
446
|
if (event.nativeEvent.contentOffset.y < height) {
|
452
|
if (event.nativeEvent.contentOffset.y < height) {
|
447
|
- this.setState({showBackTop: false, currentY: event.nativeEvent.contentOffset.y});
|
453
|
+ if (this.state.showBackTop) {
|
|
|
454
|
+ this.setState({showBackTop: false, currentY: event.nativeEvent.contentOffset.y});
|
|
|
455
|
+ }
|
448
|
}else {
|
456
|
}else {
|
449
|
- this.setState({showBackTop: true, currentY: event.nativeEvent.contentOffset.y});
|
457
|
+ if (!this.state.showBackTop) {
|
|
|
458
|
+ this.setState({showBackTop: true, currentY: event.nativeEvent.contentOffset.y});
|
|
|
459
|
+ }
|
450
|
}
|
460
|
}
|
451
|
}
|
461
|
}
|
452
|
|
462
|
|
453
|
_backTop() {
|
463
|
_backTop() {
|
454
|
- this.setState({showBackTop: false});
|
|
|
455
|
- this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true});
|
464
|
+ // this.setState({showBackTop: false});
|
|
|
465
|
+ console.log(this.state.showBackTop);
|
|
|
466
|
+ InteractionManager.runAfterInteractions(() =>{
|
|
|
467
|
+ this.listView && this.listView.scrollTo({x: 0, y: 0, animated: true});
|
|
|
468
|
+ });
|
456
|
}
|
469
|
}
|
457
|
|
470
|
|
458
|
_renderFooter() {
|
471
|
_renderFooter() {
|