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
68f989c1
Commit
68f989c1
authored
Jul 20, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
Didam See merge request
!41
parents
39d50581
a8098f1b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
192 additions
and
46 deletions
+192
-46
CartScreen.js
App/Containers/CartScreen.js
+100
-12
CategoryScreen.js
App/Containers/CategoryScreen.js
+1
-0
DetailProductScreen.js
App/Containers/DetailProductScreen.js
+40
-6
ListAddressScreen.js
App/Containers/ListAddressScreen.js
+3
-2
ListSearchScreen.js
App/Containers/ListSearchScreen.js
+19
-22
MyAccountScreen.js
App/Containers/MyAccountScreen.js
+14
-0
WishlistScreen.js
App/Containers/WishlistScreen.js
+13
-4
Api.js
App/Services/Api.js
+2
-0
No files found.
App/Containers/CartScreen.js
View file @
68f989c1
...
...
@@ -15,6 +15,7 @@ import Api from '../Services/Api';
import
BaseButton
from
'../Components/BaseButton'
;
import
{
formatRp
,
handlePhone
}
from
'../Lib/Utils'
;
import
Constant
from
'../Lib/Constant'
;
import
Toast
from
'react-native-toast-message'
;
class
CartScreen
extends
Component
{
constructor
(
props
)
{
...
...
@@ -25,7 +26,7 @@ class CartScreen extends Component {
asal
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
],
listCart
:
[],
arrayDelete
:
[],
currency
:
''
currency
:
''
,
}
}
...
...
@@ -68,6 +69,7 @@ class CartScreen extends Component {
this
.
setState
({
listCart
:
dataKosong
})
},
1000
);
}
else
{
this
.
setState
({
listCart
:
[]})
// console.log('inikah', response.data)
}
...
...
@@ -78,19 +80,91 @@ class CartScreen extends Component {
let
arrayDelete
=
[]
arrayDelete
.
push
(
item
)
Api
.
create
().
deleteCart
({
cart_id
:
arrayDelete
}).
then
((
response
)
=>
{
console
.
log
(
response
)
this
.
getCart
()
if
(
response
.
data
.
status
==
'success'
)
{
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
this
.
getCart
()
}
})
}
hanldeSize
(
item
,
value
){
let
indexId
=
this
.
state
.
listCart
.
findIndex
((
val
)
=>
val
.
cart_id
==
item
.
cart_id
)
let
listCartCopy
=
Object
.
assign
([]
,
this
.
state
.
listCart
)
listCartCopy
[
indexId
].
size_id
=
value
let
payload
=
{
"cart_id"
:
item
.
cart_id
,
"product_id"
:
item
.
product_id
,
"size_id"
:
listCartCopy
[
indexId
].
size_id
,
"quantity"
:
""
,
"price"
:
String
(
item
.
price
),
"total_price"
:
String
(
item
.
total_price
)
}
Api
.
create
().
editCart
(
payload
).
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
}
else
{
Toast
.
show
({
type
:
'failed'
,
position
:
'bottom'
,
text1
:
'Failed'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
}
})
this
.
setState
({
listCart
:
listCartCopy
})
}
handleQty
(
inputText
,
type
,
item
)
{
let
indexId
=
this
.
state
.
listCart
.
findIndex
((
val
)
=>
val
.
cart_id
==
item
.
cart_id
)
let
listCartCopy
=
Object
.
assign
([]
,
this
.
state
.
listCart
)
if
(
inputText
)
{
listCartCopy
[
indexId
].
quantity
=
type
}
else
{
listCartCopy
[
indexId
].
quantity
=
type
==
'-'
?
listCartCopy
[
indexId
].
quantity
-
1
:
listCartCopy
[
indexId
].
quantity
+
1
listCartCopy
[
indexId
].
quantity
=
type
==
'-'
?
(
listCartCopy
[
indexId
].
quantity
<=
1
?
1
:
listCartCopy
[
indexId
].
quantity
-
1
)
:
(
listCartCopy
[
indexId
].
quantity
>=
15
?
15
:
listCartCopy
[
indexId
].
quantity
+
1
)
}
listCartCopy
[
indexId
].
total_price
=
listCartCopy
[
indexId
].
quantity
*
item
.
price
let
payload
=
{
"cart_id"
:
item
.
cart_id
,
"product_id"
:
item
.
product_id
,
"size_id"
:
""
,
"quantity"
:
listCartCopy
[
indexId
].
quantity
,
"price"
:
String
(
item
.
price
),
"total_price"
:
String
(
listCartCopy
[
indexId
].
total_price
)
}
Api
.
create
().
editCart
(
payload
).
then
((
response
)
=>
{
console
.
log
(
'ini bro'
,
payload
)
console
.
log
(
'ini bro xxx'
,
response
.
data
)
})
this
.
setState
({
listCart
:
listCartCopy
})
}
...
...
@@ -108,6 +182,22 @@ class CartScreen extends Component {
return
String
(
formatRp
(
this
.
state
.
currency
,
total
))
}
handleDefaultSize
(
item
)
{
let
defaultSize
=
item
.
default_size
let
sizeId
=
item
.
size_id
let
indexId
=
defaultSize
.
findIndex
((
val
)
=>
val
.
size_id
==
sizeId
)
if
(
defaultSize
.
length
>
0
)
{
if
(
indexId
!=
-
1
)
{
return
sizeId
}
else
{
return
defaultSize
[
0
].
value
}
}
else
{
return
null
}
}
render
()
{
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
...
...
@@ -139,7 +229,7 @@ class CartScreen extends Component {
<
BaseText
text
=
{
item
.
product_name
}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
6
}}
/
>
<
/View
>
<
View
style
=
{{
alignItems
:
'flex-end'
,
width
:
'40%'
,
flexGrow
:
1
}}
>
<
BaseText
text
=
{
String
(
formatRp
(
this
.
state
.
currency
,
item
.
price
))}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
8
,
color
:
'#4cc9f0'
}}
/
>
<
BaseText
text
=
{
String
(
formatRp
(
this
.
state
.
currency
,
item
.
total_
price
))}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
8
,
color
:
'#4cc9f0'
}}
/
>
<
BaseText
text
=
{
"Grosir"
}
type
=
{
"bold"
}
style
=
{{
opacity
:
.
5
,
fontSize
:
12
}}
/
>
<
/View
>
<
/View
>
...
...
@@ -150,7 +240,7 @@ class CartScreen extends Component {
<
/View
>
<
/View
>
<
View
style
=
{{
paddingHorizontal
:
20
,
paddingBottom
:
20
}}
>
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
,
}}
>
<
BaseText
text
=
{
"Jumlah"
}
type
=
{
"regular"
}
style
=
{{
opacity
:
.
4
,
width
:
'20%'
}}
/
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginLeft
:
10
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleQty
(
false
,
'-'
,
item
)}
style
=
{{
backgroundColor
:
'#f1f1f1'
,
width
:
25
,
padding
:
5
,
alignItems
:
'center'
,
justifyContent
:
'center'
,}}
>
...
...
@@ -168,14 +258,14 @@ class CartScreen extends Component {
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
,}}
>
{
item
.
default_size
.
length
>
0
&&
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
,}}
>
<
BaseText
text
=
{
"Ukuran"
}
type
=
{
"regular"
}
style
=
{{
opacity
:
.
4
,
width
:
'20%'
}}
/
>
<
View
style
=
{{
width
:
100
,
marginLeft
:
10
}}
>
<
DropDownPicker
items
=
{
item
.
default_size
}
placeholder
=
{
"Pilih Ukuran"
}
placeholderStyle
=
{{
margin
:
0
,
padding
:
0
}}
// defaultValue={item.size_id
}
defaultValue
=
{
this
.
handleDefaultSize
(
item
)
}
containerStyle
=
{{
height
:
40
,
alignItems
:
'center'
,}}
style
=
{{
marginHorizontal
:
0
,
paddingHorizontal
:
0
,
backgroundColor
:
'#fff'
,
zIndex
:
1
,
borderTopWidth
:
0
,
borderLeftWidth
:
0
,
borderRightWidth
:
0
,}}
itemStyle
=
{{
...
...
@@ -186,12 +276,10 @@ class CartScreen extends Component {
activeLabelStyle
=
{{
color
:
'#4cc9f0'
}}
dropDownMaxHeight
=
{
200
}
dropDownStyle
=
{{
backgroundColor
:
'#fff'
,
height
:
200
}}
onChangeItem
=
{
item
=>
this
.
setState
({
ukuran
:
item
.
value
,
})}
onChangeItem
=
{
items
=>
this
.
hanldeSize
(
item
,
items
.
value
)}
/
>
<
/View
>
<
/View
>
<
/View>
}
<
/View
>
<
View
style
=
{{
width
:
'100%'
,
height
:
10
,
backgroundColor
:
'#ececec'
}}
/
>
{
index
==
this
.
state
.
listCart
.
length
-
1
&&
<
View
style
=
{{
height
:
200
,
backgroundColor
:
'transparent'
,
width
:
'100%'
}}
/>
}
...
...
App/Containers/CategoryScreen.js
View file @
68f989c1
...
...
@@ -61,6 +61,7 @@ class CategoryScreen extends Component {
{
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
return
(
<
TouchableOpacity
key
=
{
index
}
style
=
{{
backgroundColor
:
index
%
2
==
0
?
'#b89469'
:
index
%
3
==
0
?
'#7a7a7d'
:
'#636066'
,
borderRadius
:
16
,
height
:
90
,
width
:
'100%'
,
marginBottom
:
15
,
marginTop
:
index
==
0
?
20
:
0
,
justifyContent
:
'space-between'
,
paddingHorizontal
:
20
,
flexDirection
:
'row'
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'ListSearchScreen'
,
{
catID
:
item
.
cat_id
})}
>
...
...
App/Containers/DetailProductScreen.js
View file @
68f989c1
...
...
@@ -16,6 +16,7 @@ import Constant from '../Lib/Constant';
import
{
formatRp
,
titleCase
}
from
'../Lib/Utils'
;
import
BaseButton
from
'../Components/BaseButton'
;
import
Modal
from
'react-native-modal'
;
import
Toast
from
'react-native-toast-message'
;
class
DetailProductScreen
extends
Component
{
constructor
(
props
)
{
...
...
@@ -29,12 +30,14 @@ class DetailProductScreen extends Component {
varient
:
[],
varientId
:
0
,
opacity
:
0
,
typeCart
:
''
,
varientModal
:
false
,
auth
:
this
.
props
.
auth
}
}
componentDidMount
()
{
console
.
log
(
this
.
state
.
productId
)
this
.
getCurrency
()
this
.
getProductDetail
()
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
...
...
@@ -85,13 +88,26 @@ class DetailProductScreen extends Component {
if
(
this
.
state
.
auth
.
user
!=
null
)
{
let
payload
=
{
"product_id"
:
item
.
product_id
,
"varient_id"
:
item
.
varient
I
d
,
"varient_id"
:
item
.
varient
_i
d
,
"quantity"
:
1
,
"price"
:
this
.
state
.
dataProduct
.
price
,
"total_price"
:
this
.
state
.
dataProduct
.
price
}
Api
.
create
().
addCart
(
payload
).
then
((
response
)
=>
{
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
this
.
setState
({
varientModal
:
false
})
if
(
this
.
state
.
typeCart
==
'beli'
)
{
this
.
props
.
navigation
.
navigate
(
'CartScreen'
)
}
})
}
}
...
...
@@ -101,12 +117,30 @@ class DetailProductScreen extends Component {
if
(
this
.
state
.
auth
.
user
!=
null
)
{
if
(
this
.
state
.
dataProduct
.
is_wishlist
)
{
Api
.
create
().
deleteWishlist
(
this
.
state
.
dataProduct
.
product_id
).
then
((
response
)
=>
{
console
.
log
(
response
)
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
this
.
getProductDetail
()
})
}
else
{
Api
.
create
().
addWishlist
(
payload
).
then
((
response
)
=>
{
console
.
log
(
response
)
Toast
.
show
({
type
:
'success'
,
position
:
'bottom'
,
text1
:
'Success'
,
text2
:
response
.
data
.
message
,
visibilityTime
:
2500
,
autoHide
:
true
,
// topOffset: 100,
// bottomOffset: 40,
})
this
.
getProductDetail
()
})
}
...
...
@@ -196,7 +230,7 @@ class DetailProductScreen extends Component {
<
View
style
=
{{
height
:
1
,
width
:
'100%'
,
backgroundColor
:
'#d8d8d8'
,
marginVertical
:
20
}}
/
>
<
View
style
=
{{
paddingHorizontal
:
25
}}
>
<
BaseText
type
=
{
"bold"
}
text
=
{
'Deskripsi'
}
style
=
{{
fontSize
:
16
,
color
:
'#4b4b4b'
,
marginBottom
:
10
}}
/
>
<
BaseText
type
=
{
"regular"
}
text
=
{
this
.
state
.
dataProduct
.
size_description
}
/
>
<
BaseText
type
=
{
"regular"
}
text
=
{
this
.
state
.
dataProduct
.
description
!=
null
?
this
.
state
.
dataProduct
.
description
:
'-'
}
/
>
<
/View
>
<
/View
>
<
/View
>
...
...
@@ -216,10 +250,10 @@ class DetailProductScreen extends Component {
<
Image
source
=
{
Images
.
icon_chat
}
style
=
{{
width
:
50
,
height
:
50
}}
/
>
<
/TouchableOpacity
>
<
View
style
=
{{
width
:
'40%'
}}
>
<
BaseButton
text
=
{
'Beli'
}
onPress
=
{()
=>
null
}
fontSizeText
=
{
12
}
/
>
<
BaseButton
text
=
{
'Beli'
}
onPress
=
{()
=>
this
.
setState
({
varientModal
:
true
,
typeCart
:
'beli'
})
}
fontSizeText
=
{
12
}
/
>
<
/View
>
<
View
style
=
{{
width
:
'40%'
}}
>
<
BaseButton
text
=
{
'+ Keranjang'
}
onPress
=
{()
=>
this
.
setState
({
varientModal
:
true
})}
fontSizeText
=
{
12
}
color
=
{
'white'
}
textColor
=
{
'#4cc9f0'
}
style
=
{{
borderWidth
:
1
,
borderColor
:
'#4cc9f0'
}}
/
>
<
BaseButton
text
=
{
'+ Keranjang'
}
onPress
=
{()
=>
this
.
setState
({
varientModal
:
true
,
typeCart
:
'keranjang'
})}
fontSizeText
=
{
12
}
color
=
{
'white'
}
textColor
=
{
'#4cc9f0'
}
style
=
{{
borderWidth
:
1
,
borderColor
:
'#4cc9f0'
}}
/
>
<
/View
>
<
/View
>
<
/View
>
...
...
App/Containers/ListAddressScreen.js
View file @
68f989c1
...
...
@@ -93,10 +93,11 @@ class ListAddressScreen extends Component {
<
/View
>
<
/Modal
>
<
ModalBox
backButtonClose
=
{()
=>
this
.
setState
({
other
:
false
})}
backButtonClose
=
{
true
}
onClosed
=
{()
=>
this
.
setState
({
other
:
false
})}
position
=
"bottom"
isOpen
=
{
this
.
state
.
other
}
style
=
{{
height
:
60
}}
style
=
{{
height
:
85
}}
coverScreen
=
{
true
}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'white'
,
width
:
'100%'
,
paddingVertical
:
10
,
paddingHorizontal
:
20
,
justifyContent
:
'center'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
setState
({
other
:
false
},
()
=>
this
.
changeStatus
())}
>
...
...
App/Containers/ListSearchScreen.js
View file @
68f989c1
...
...
@@ -41,14 +41,11 @@ class ListSearchScreen extends Component {
}
componentDidMount
()
{
if
(
this
.
props
.
navigation
.
state
)
{
if
(
this
.
props
.
navigation
.
state
.
params
.
catID
)
{
let
categoryId
=
[]
categoryId
.
push
(
this
.
props
.
navigation
.
state
.
params
.
catID
)
this
.
setState
({
categoryId
},
()
=>
this
.
getAllProduct
())
}
else
{
this
.
getAllProduct
()
}
let
catID
=
this
.
props
.
navigation
.
state
.
params
==
undefined
?
''
:
this
.
props
.
navigation
.
state
.
params
.
catID
if
(
catID
!=
''
)
{
let
categoryId
=
[]
categoryId
.
push
(
catID
)
this
.
setState
({
categoryId
},
()
=>
this
.
getAllProduct
())
}
else
{
this
.
getAllProduct
()
}
...
...
@@ -69,7 +66,7 @@ class ListSearchScreen extends Component {
}
Api
.
create
().
getAllProduct
(
payload
).
then
((
response
)
=>
{
console
.
log
(
payload
)
console
.
log
(
response
.
data
)
//
console.log(response.data)
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
listData
:
this
.
state
.
listData
.
concat
(
response
.
data
.
data
)
})
}
...
...
@@ -131,19 +128,19 @@ class ListSearchScreen extends Component {
<
View
style
=
{{
flex
:
1
}}
>
<
StatusBar
backgroundColor
=
{
'transparent'
}
translucent
=
{
true
}
barStyle
=
{
'light-content'
}
/
>
<
BaseHeader
onSubmitEditing
=
{()
=>
{
this
.
setState
({
listData
:
[]
},
()
=>
{
this
.
refreshState
()
this
.
getAllProduct
()
})
}}
onClose
=
{()
=>
{
this
.
setState
({
listData
:
[],
search
:
''
},
()
=>
{
this
.
refreshState
()
this
.
getAllProduct
()
})
}}
value
=
{
this
.
state
.
search
}
onChangeText
=
{(
search
)
=>
this
.
setState
({
search
})}
placeholder
=
{
'Cari Product'
}
//
onSubmitEditing={() => {
//
this.setState({ listData: [] }, () => {
//
this.refreshState()
//
this.getAllProduct()
//
})
//
}}
//
onClose={() => {
//
this.setState({ listData: [], search: '' }, () => {
//
this.refreshState()
//
this.getAllProduct()
//
})
//
}}
value
=
{
this
.
state
.
search
}
onChangeText
=
{(
search
)
=>
this
.
setState
({
search
}
,
()
=>
this
.
getAllProduct
()
)}
placeholder
=
{
'Cari Product'
}
typeSearch
=
{
true
}
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
/
>
<
Modal
animationOut
=
'slideOutDown'
...
...
App/Containers/MyAccountScreen.js
View file @
68f989c1
...
...
@@ -12,6 +12,7 @@ import BaseHeader from '../Components/BaseHeader';
import
{
Images
}
from
'../Themes'
;
import
BaseText
from
'../Components/BaseText'
;
import
Toast
from
'react-native-toast-message'
import
Api
from
'../Services/Api'
class
MyAccountScreen
extends
Component
{
constructor
(
props
)
{
...
...
@@ -66,6 +67,19 @@ class MyAccountScreen extends Component {
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
:
[
...
...
App/Containers/WishlistScreen.js
View file @
68f989c1
import
React
,
{
Component
}
from
'react'
import
{
ScrollView
,
Text
,
KeyboardAvoidingView
,
View
,
Image
,
Alert
,
BackHandler
,
TextInput
,
FlatList
,
TouchableOpacity
}
from
'react-native'
import
{
ScrollView
,
Text
,
KeyboardAvoidingView
,
View
,
Image
,
Alert
,
BackHandler
,
TextInput
,
FlatList
,
TouchableOpacity
,
AsyncStorage
}
from
'react-native'
import
{
connect
}
from
'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
...
...
@@ -12,6 +12,8 @@ import Ionicons from 'react-native-vector-icons/Ionicons'
import
FontAwesome
from
'react-native-vector-icons/FontAwesome'
import
BaseText
from
'../Components/BaseText'
import
Api
from
'../Services/Api'
import
{
formatRp
}
from
'../Lib/Utils'
import
Constant
from
'../Lib/Constant'
class
WishlistScreen
extends
Component
{
constructor
(
props
)
{
...
...
@@ -26,7 +28,8 @@ class WishlistScreen extends Component {
],
data
:
[],
text
:
""
,
isSecondColumn
:
false
isSecondColumn
:
false
,
currency
:
''
}
}
backAction
=
()
=>
{
...
...
@@ -44,6 +47,7 @@ class WishlistScreen extends Component {
componentDidMount
()
{
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
this
.
getWhistlist
()
this
.
getCurrency
()
let
isSecondColumn
=
this
.
state
.
dummyList
.
length
%
2
===
0
this
.
setState
({
isSecondColumn
})
}
...
...
@@ -52,6 +56,11 @@ class WishlistScreen extends Component {
BackHandler
.
removeEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
}
async
getCurrency
()
{
let
currency
=
await
AsyncStorage
.
getItem
(
Constant
.
GLOBAL_CURRENCY
)
this
.
setState
({
currency
})
}
getWhistlist
()
{
let
body
=
{
"offset"
:
0
,
...
...
@@ -117,14 +126,14 @@ class WishlistScreen extends Component {
renderItem
=
{({
item
,
index
})
=>
{
return
(
<
View
style
=
{{
flex
:
1
/
2
,
flexDirection
:
'column'
,
margin
:
10
,
backgroundColor
:
'#fff'
,
borderRadius
:
15
,
elevation
:
3
,
marginTop
:
index
==
0
?
20
:
index
==
1
?
20
:
0
,
marginRight
:
index
==
this
.
state
.
dummyList
.
length
-
1
&&
this
.
state
.
isSecondColumn
==
false
?
30
:
10
}}
>
<
TouchableOpacity
style
=
{{
flex
:
1
}}
onPress
=
{()
=>
null
}
>
<
TouchableOpacity
style
=
{{
flex
:
1
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'DetailProductScreen'
,
{
productId
:
item
.
product_id
})
}
>
<
View
style
=
{{
backgroundColor
:
item
.
color
,
width
:
'100%'
,
height
:
148
,
borderRadius
:
10
}}
>
<
Image
source
=
{{
uri
:
item
.
product_image
}}
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
/
>
<
Image
source
=
{
Images
.
wishlistBulat
}
style
=
{{
width
:
24
,
height
:
24
,
alignSelf
:
'flex-end'
,
position
:
'absolute'
,
right
:
10
,
top
:
10
}}
/
>
<
/View
>
<
View
style
=
{{
paddingHorizontal
:
10
,
marginVertical
:
10
,
justifyContent
:
'space-between'
,
flex
:
1
}}
>
<
BaseText
type
=
{
"regular"
}
text
=
{
item
.
product_name
}
style
=
{{
fontSize
:
14
,
color
:
'black'
,
textAlign
:
'left'
,
}}
ellipsizeMode
=
{
"tail"
}
numberOfLines
=
{
2
}
/
>
<
BaseText
type
=
{
"regular"
}
text
=
{
item
.
price
}
style
=
{{
fontSize
:
10
,
color
:
'black'
,
textAlign
:
'left'
,
marginTop
:
5
}}
/
>
<
BaseText
type
=
{
"regular"
}
text
=
{
formatRp
(
this
.
state
.
currency
,
item
.
price
)
}
style
=
{{
fontSize
:
10
,
color
:
'black'
,
textAlign
:
'left'
,
marginTop
:
5
}}
/
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
...
...
App/Services/Api.js
View file @
68f989c1
...
...
@@ -63,6 +63,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const
getRate
=
()
=>
api
.
get
(
'rate_limit'
)
const
getUser
=
(
username
)
=>
api
.
get
(
'search/users'
,
{
q
:
username
})
const
login
=
(
body
)
=>
api
.
post
(
'login'
,
body
)
const
logout
=
(
userId
)
=>
api
.
post
(
`logout/
${
userId
}
`
)
const
registerUser
=
(
body
)
=>
api
.
post
(
'register'
,
body
)
const
changePassword
=
(
body
)
=>
api
.
post
(
'change_password'
,
body
)
const
forgotPassword
=
(
body
)
=>
api
.
post
(
'forgot_password'
,
body
)
...
...
@@ -133,6 +134,7 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
contactUs
,
getUser
,
login
,
logout
,
registerUser
,
changePassword
,
forgotPassword
,
...
...
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