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
chenl
8 years ago
Commit
0afe6a29d352b17a36f72fdeb876229fab7d85be
1 parent
45b84054
调整了品牌的swiper控件。review by 孙凯。
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
28 deletions
js/classify/components/brand/BrandSwiper.js
js/common/components/YH_Swiper.js
js/classify/components/brand/BrandSwiper.js
View file @
0afe6a2
...
...
@@ -2,14 +2,13 @@
import
React
from
'react'
;
import
ReactNative
from
'react-native'
;
import
Swiper
from
'react-native-swiper'
;
import
ImmutablePropTypes
from
'react-immutable-proptypes'
;
import
SlicedImage
from
'../../../common/components/SlicedImage'
;
import
Immutable
,
{
Map
}
from
'immutable'
;
import
YH_Image
from
'../../../common/components/YH_Image'
;
import
{
getSlicedUrl
}
from
'../../utils/Utils'
;
import
DeviceInfo
from
'react-native-device-info'
;
import
YH_Swiper
from
'../../../common/components/YH_Swiper'
;
const
{
View
,
...
...
@@ -25,28 +24,6 @@ export default class BrandSwiper extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
dot
=
<
View
style
=
{{
backgroundColor
:
'rgba(237, 237, 237, 0.5)'
,
width
:
6
,
height
:
6
,
borderRadius
:
3
,
marginLeft
:
3
,
marginRight
:
3
,
marginTop
:
0
,
}}
/>
;
this
.
activeDot
=
<
View
style
=
{{
backgroundColor
:
'white'
,
width
:
6
,
height
:
6
,
borderRadius
:
3
,
marginLeft
:
3
,
marginRight
:
3
,
marginTop
:
0
,
}}
/>
;
//A版比例640X330 B版比例640X310
height
=
this
.
props
.
abversion
==
"B"
?
Math
.
ceil
((
310
/
640
)
*
width
)
:
Math
.
ceil
((
330
/
640
)
*
width
);
}
...
...
@@ -114,14 +91,12 @@ export default class BrandSwiper extends React.Component {
}
else
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
Swiper
<
YH_
Swiper
style
=
{
styles
.
banner
}
showsButtons
=
{
false
}
loop
=
{
true
}
autoplay
=
{
true
}
autoplayTimeout
=
{
3
}
dot
=
{
this
.
dot
}
activeDot
=
{(
Platform
.
OS
===
'ios'
)?
this
.
activeDot
:
null
}
width
=
{
width
}
height
=
{
height
+
15
}
paginationStyle
=
{{
backgroundColor
:
'rgba(0,0,0,0.2)'
,
bottom
:
25
,
height
:
10
,
width
:
list
.
length
*
12
,
borderRadius
:
5
,
marginLeft
:
(
width
-
list
.
length
*
12
)
/
2
}}
...
...
@@ -154,7 +129,7 @@ export default class BrandSwiper extends React.Component {
<
/TouchableOpacity
>
);
})}
<
/Swiper
>
<
/
YH_
Swiper
>
<
/View
>
);
}
...
...
js/common/components/YH_Swiper.js
0 → 100644
View file @
0afe6a2
import
React
from
'react'
;
import
ReactNative
from
'react-native'
;
import
Swiper
from
'react-native-swiper'
;
import
RecyclerSwiper
from
'../recycler-swiper/recyclerswiper'
const
{
Component
,
}
=
React
;
const
{
View
,
Platform
,
}
=
ReactNative
;
/**
* 轮播图片
*
**/
export
default
class
YH_Swiper
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
dot
=
<
View
style
=
{{
backgroundColor
:
'rgba(237, 237, 237, 0.5)'
,
width
:
6
,
height
:
6
,
borderRadius
:
3
,
marginLeft
:
3
,
marginRight
:
3
,
marginTop
:
0
,
}}
/>
;
this
.
activeDot
=
<
View
style
=
{{
backgroundColor
:
'white'
,
width
:
6
,
height
:
6
,
borderRadius
:
3
,
marginLeft
:
3
,
marginRight
:
3
,
marginTop
:
0
,
}}
/>
;
}
render
()
{
if
(
Platform
.
OS
===
'ios'
)
{
return
(
<
Swiper
dot
=
{
this
.
dot
}
activeDot
=
{
this
.
activeDot
}
{...
this
.
props
}
>
{
this
.
props
.
children
}
<
/Swiper
>
);
}
else
{
return
(
<
RecyclerSwiper
dot
=
{
this
.
dot
}
activeDot
=
{
this
.
activeDot
}
{...
this
.
props
}
>
{
this
.
props
.
children
}
<
/RecyclerSwiper
>
);
}
}
}
...
...
Please
register
or
login
to post a comment