Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eCartPro-Customer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
eCartPro-Customer
Commits
8ef3621f
Commit
8ef3621f
authored
Aug 03, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
update See merge request
!57
parents
1f49b78d
770bef86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
34 deletions
+55
-34
HomePageScreen.js
App/Containers/HomePageScreen.js
+18
-8
MyAccountScreen.js
App/Containers/MyAccountScreen.js
+33
-24
Api.js
App/Services/Api.js
+4
-2
No files found.
App/Containers/HomePageScreen.js
View file @
8ef3621f
...
...
@@ -34,7 +34,8 @@ class HomePageScreen extends Component {
open
:
false
,
authView
:
false
,
user
:
this
.
props
.
user
,
cartLength
:
0
cartLength
:
0
,
banner
:
[]
}
}
...
...
@@ -75,6 +76,15 @@ class HomePageScreen extends Component {
// bottomOffset: 40,
})
}
getBanner
()
{
Api
.
create
().
getBanner
().
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
banner
:
response
.
data
.
data
})
}
console
.
log
(
response
.
data
)
})
}
drawerContent
=
()
=>
{
return
(
...
...
@@ -148,7 +158,7 @@ class HomePageScreen extends Component {
_renderItem
=
({
item
,
index
})
=>
{
return
(
<
View
style
=
{{
height
:
'100%'
}}
>
<
Image
source
=
{
item
}
style
=
{{
width
:
Metrics
.
screenWidth
,
height
:
'100%'
}}
/
>
<
Image
source
=
{
{
uri
:
item
.
banner_image
}
}
style
=
{{
width
:
Metrics
.
screenWidth
,
height
:
'100%'
}}
/
>
<
/View
>
);
}
...
...
@@ -168,8 +178,8 @@ class HomePageScreen extends Component {
componentDidMount
()
{
this
.
getCart
()
this
.
getAppInfo
()
this
.
getBanner
()
if
(
this
.
state
.
user
==
null
)
{
this
.
setState
({
authView
:
true
})
}
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
...
...
@@ -214,7 +224,7 @@ class HomePageScreen extends Component {
>
<
View
style
=
{{
marginBottom
:
-
15
}}
>
<
View
style
=
{{
zIndex
:
1
,
flexGrow
:
1
,
alignItems
:
'center'
,
width
:
'100%'
,
elevation
:
this
.
state
.
opacity
==
1
?
10
:
0
,
position
:
'absolute'
,
top
:
0
,
paddingBottom
:
10
,
paddingHorizontal
:
25
,
paddingTop
:
this
.
state
.
open
?
STATUSBAR_HEIGHT
-
10
:
STATUSBAR_HEIGHT
+
25
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
backgroundColor
:
`rgba(255, 255, 255,
${
this
.
state
.
opacity
}
)`
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
setState
({
open
:
true
})}
style
=
{{
width
:
'1
0
%'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
setState
({
open
:
true
})}
style
=
{{
width
:
'1
5
%'
}}
>
<
FontAwesome
name
=
"bars"
size
=
{
20
}
color
=
{
this
.
state
.
opacity
>=
.
5
?
'#e3e3e3'
:
'#FFF'
}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
width
:
'70%'
,
elevation
:
this
.
state
.
opacity
==
1
?
0
:
5
,
alignItems
:
'center'
,
flexDirection
:
'row'
,
paddingVertical
:
12
,
paddingHorizontal
:
15
,
backgroundColor
:
this
.
state
.
opacity
>=
.
5
?
'#f1f1f1'
:
'#FFF'
,
borderRadius
:
25
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'ListSearchScreen'
)}
>
...
...
@@ -237,20 +247,20 @@ class HomePageScreen extends Component {
<
View
style
=
{{
height
:
450
,
width
:
'100%'
,
backgroundColor
:
'white'
}}
>
<
Carousel
ref
=
{(
c
)
=>
{
this
.
_carousel
=
c
;
}}
data
=
{
this
.
state
.
banner
Dummy
}
data
=
{
this
.
state
.
banner
}
renderItem
=
{
this
.
_renderItem
}
sliderWidth
=
{
Metrics
.
screenWidth
}
itemWidth
=
{
Metrics
.
screenWidth
}
autoplay
=
{
true
}
loop
=
{
true
}
loopClonesPerSide
=
{
this
.
state
.
banner
Dummy
.
length
}
loopClonesPerSide
=
{
this
.
state
.
banner
.
length
}
// layout={'stack'}
onSnapToItem
=
{(
index
)
=>
this
.
setState
({
activeSlide
:
index
})
}
/
>
<
/View
>
<
View
style
=
{{
width
:
'100%'
,
backgroundColor
:
'transparent'
,
marginTop
:
-
100
}}
>
{
this
.
state
.
banner
Dummy
.
length
>
0
&&
<
View
style
=
{{
backgroundColor
:
'transparent'
,
alignItems
:
'center'
,
width
:
"100%"
,
padding
:
20
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,}}
>
{
this
.
state
.
banner
Dummy
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
banner
.
length
>
0
&&
<
View
style
=
{{
backgroundColor
:
'transparent'
,
alignItems
:
'center'
,
width
:
"100%"
,
padding
:
20
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,}}
>
{
this
.
state
.
banner
.
map
((
item
,
index
)
=>
{
return
(
<
View
key
=
{
index
}
style
=
{{
backgroundColor
:
this
.
state
.
activeSlide
==
index
?
'#4cc9f0'
:
'#e6e6e6'
,
width
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
height
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
borderRadius
:
10
,
marginLeft
:
index
==
0
?
0
:
10
}}
/
>
)
...
...
App/Containers/MyAccountScreen.js
View file @
8ef3621f
...
...
@@ -66,31 +66,40 @@ class MyAccountScreen extends Component {
}
else
if
(
type
==
'Kata Sandi'
)
{
this
.
props
.
navigation
.
navigate
(
'ChangePasswordScreen'
);
}
else
if
(
type
==
'Keluar'
)
{
this
.
props
.
authClearData
()
Api
.
create
().
logout
(
this
.
props
.
auth
.
user
.
data
.
user_id
).
then
((
response
)
=>
{
// console.log(response.data)
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
`
${
response
.
data
.
message
}
👋`
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
})
const
resetAction
=
StackActions
.
reset
({
index
:
0
,
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'HomeNavigation'
,
Alert
.
alert
(
"Konfirmasi"
,
"Apakah anda yakin ingin keluar?"
,
[
{
text
:
"Tidak"
,
onPress
:
()
=>
null
,
style
:
"cancel"
},
{
text
:
"Ya"
,
onPress
:
()
=>
{
this
.
props
.
authClearData
()
Api
.
create
().
logout
(
this
.
props
.
auth
.
user
.
data
.
user_id
).
then
((
response
)
=>
{
// console.log(response.data)
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
`
${
response
.
data
.
message
}
👋`
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
})
],
key
:
null
});
AsyncStorage
.
clear
()
this
.
props
.
navigation
.
dispatch
(
resetAction
);
const
resetAction
=
StackActions
.
reset
({
index
:
0
,
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'HomeNavigation'
,
})
],
key
:
null
});
AsyncStorage
.
clear
()
this
.
props
.
navigation
.
dispatch
(
resetAction
);
}
}
]);
}
else
{
}
...
...
App/Services/Api.js
View file @
8ef3621f
...
...
@@ -76,7 +76,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
const
getPaymentMethod
=
()
=>
api
.
get
(
'get_payment_method'
)
const
getAllKupon
=
()
=>
api
.
get
(
'get_all_coupon'
)
const
getBanner
=
()
=>
api
.
get
(
'get_banner'
)
// Order
const
createOrder
=
(
body
)
=>
api
.
post
(
'create_order'
,
body
)
const
getOrder
=
(
body
)
=>
api
.
post
(
'get_order'
,
body
)
...
...
@@ -211,7 +212,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
cancelOrder
,
getCancelReasonOrder
,
getOrderStatus
,
getAllKupon
getAllKupon
,
getBanner
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment