Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shangjf
8 years ago
Commit
69b230bdcbe4516de5ad1c24ae449570a8bd1773
1 parent
e2841033
首页切换频道 review by 于良
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
js/home/components/home/Home.js
js/home/containers/HomeContainer.js
js/home/components/home/Home.js
View file @
69b230b
...
...
@@ -14,6 +14,7 @@ import ReactNative, {
Platform
,
RefreshControl
,
}
from
'react-native'
;
import
TimerMixin
from
'react-timer-mixin'
;
import
Immutable
,
{
Map
}
from
'immutable'
;
import
LoadMoreIndicator
from
'../../../common/components/LoadMoreIndicator'
;
import
YH_SortView
from
'../../../common/components/YH_SortView'
;
...
...
@@ -84,6 +85,11 @@ export default class Home extends Component {
}
}
componentWillUnmount
()
{
this
.
requestAnimationFrame
&&
TimerMixin
.
cancelAnimationFrame
(
this
.
requestAnimationFrame
);
}
trigggePullToRefresh
(
changeChannel
=
false
)
{
let
data
=
this
.
_currentChannelData
();
if
(
changeChannel
)
{
...
...
@@ -150,8 +156,8 @@ export default class Home extends Component {
<
DivideImage
/>
<
SingleImage
data
=
{
rowData
}
onPressSlideItem
=
{
this
.
props
.
onPressSlideItem
}
onPressTitleMore
=
{
this
.
props
.
onPressTitleMore
}
onPressSlideItem
=
{
this
.
props
.
onPressChangeChannel
}
onPressTitleMore
=
{
this
.
props
.
onPressChangeChannel
}
/
>
<
/View
>
);
...
...
@@ -444,15 +450,22 @@ export default class Home extends Component {
_onScroll
(
event
)
{
if
(
event
.
nativeEvent
.
contentOffset
.
y
<
height
)
{
this
.
setState
({
showBackTop
:
false
,
currentY
:
event
.
nativeEvent
.
contentOffset
.
y
});
if
(
this
.
state
.
showBackTop
)
{
this
.
setState
({
showBackTop
:
false
,
currentY
:
event
.
nativeEvent
.
contentOffset
.
y
});
}
}
else
{
this
.
setState
({
showBackTop
:
true
,
currentY
:
event
.
nativeEvent
.
contentOffset
.
y
});
if
(
!
this
.
state
.
showBackTop
)
{
this
.
setState
({
showBackTop
:
true
,
currentY
:
event
.
nativeEvent
.
contentOffset
.
y
});
}
}
}
_backTop
()
{
this
.
setState
({
showBackTop
:
false
});
this
.
listView
&&
this
.
listView
.
scrollTo
({
x
:
0
,
y
:
0
,
animated
:
true
});
// this.setState({showBackTop: false});
console
.
log
(
this
.
state
.
showBackTop
);
InteractionManager
.
runAfterInteractions
(()
=>
{
this
.
listView
&&
this
.
listView
.
scrollTo
({
x
:
0
,
y
:
0
,
animated
:
true
});
});
}
_renderFooter
()
{
...
...
js/home/containers/HomeContainer.js
View file @
69b230b
...
...
@@ -76,6 +76,7 @@ class HomeContainer extends Component {
this
.
onPressProductListProduct
=
this
.
onPressProductListProduct
.
bind
(
this
);
this
.
onPressToProductDetail
=
this
.
onPressToProductDetail
.
bind
(
this
);
this
.
onPressReloadData
=
this
.
onPressReloadData
.
bind
(
this
);
this
.
onPressChangeChannel
=
this
.
onPressChangeChannel
.
bind
(
this
);
this
.
subscription
=
NativeAppEventEmitter
.
addListener
(
'ChannelDidChangeEvent'
,
...
...
@@ -280,6 +281,17 @@ class HomeContainer extends Component {
this
.
props
.
actions
.
fetchFloor
();
}
onPressChangeChannel
()
{
let
{
app
}
=
this
.
props
;
if
(
app
.
channel
==
1
)
{
console
.
log
(
1111111
);
ReactNative
.
NativeModules
.
YH_CommonHelper
.
switchChannelByTheme
(
0
);
}
else
if
(
app
.
channel
==
2
)
{
console
.
log
(
2222222
);
ReactNative
.
NativeModules
.
YH_CommonHelper
.
switchChannelByTheme
(
1
);
}
}
render
()
{
let
{
app
,
home
}
=
this
.
props
;
return
(
...
...
@@ -318,6 +330,7 @@ class HomeContainer extends Component {
onClickRecommendProduct
=
{
this
.
onClickRecommendProduct
}
onPressToProductDetail
=
{
this
.
onPressToProductDetail
}
onPressReloadData
=
{
this
.
onPressReloadData
}
onPressChangeChannel
=
{
this
.
onPressChangeChannel
}
/
>
<
/View
>
);
...
...
Please
register
or
login
to post a comment