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
c6cf0b5d
Commit
c6cf0b5d
authored
Jul 20, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
category
parent
fc5567d6
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
69 deletions
+100
-69
CategoryScreen.js
App/Containers/CategoryScreen.js
+30
-9
ListSearchScreen.js
App/Containers/ListSearchScreen.js
+70
-60
No files found.
App/Containers/CategoryScreen.js
View file @
c6cf0b5d
...
@@ -8,6 +8,8 @@ import { connect } from 'react-redux'
...
@@ -8,6 +8,8 @@ import { connect } from 'react-redux'
import
styles
from
'./Styles/CategoryScreenStyle'
import
styles
from
'./Styles/CategoryScreenStyle'
import
BaseHeader
from
'../Components/BaseHeader'
;
import
BaseHeader
from
'../Components/BaseHeader'
;
import
{
Images
}
from
'../Themes'
;
import
{
Images
}
from
'../Themes'
;
import
Api
from
'../Services/Api'
;
import
BaseText
from
'../Components/BaseText'
;
class
CategoryScreen
extends
Component
{
class
CategoryScreen
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -21,7 +23,8 @@ class CategoryScreen extends Component {
...
@@ -21,7 +23,8 @@ class CategoryScreen extends Component {
Images
.
categoryAksesoris
,
Images
.
categoryAksesoris
,
Images
.
categoryTas
,
Images
.
categoryTas
,
Images
.
categorySale
,
Images
.
categorySale
,
]
],
data
:
[]
}
}
}
}
backAction
=
()
=>
{
backAction
=
()
=>
{
...
@@ -32,21 +35,39 @@ class CategoryScreen extends Component {
...
@@ -32,21 +35,39 @@ class CategoryScreen extends Component {
componentDidMount
()
{
componentDidMount
()
{
// alert(JSON.stringify(this.props))
// alert(JSON.stringify(this.props))
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
this
.
getCategory
()
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
BackHandler
.
removeEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
BackHandler
.
removeEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
}
}
render
()
{
getCategory
()
{
Api
.
create
().
getCategory
().
then
(
response
=>
{
console
.
log
(
JSON
.
stringify
(
response
.
data
))
if
(
response
.
data
.
status
==
"success"
)
{
this
.
setState
({
data
:
response
.
data
.
data
})
}
else
{
this
.
setState
({
data
:
[]
})
}
})
}
render
()
{
return
(
return
(
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
View
style
=
{{
flex
:
1
,
backgroundColor
:
'#4cc9f0'
}}
>
<
BaseHeader
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
leftText
=
{
'Kategori'
}
/
>
<
BaseHeader
onBackPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
leftText
=
{
'Kategori'
}
/
>
<
ScrollView
showsVerticalScrollIndicator
=
{
false
}
style
=
{
[
styles
.
scrollContent
,
{
paddingHorizontal
:
25
,
paddingTop
:
25
}]
}
>
<
ScrollView
showsVerticalScrollIndicator
=
{
false
}
style
=
{
{
paddingHorizontal
:
25
,
backgroundColor
:
'#fff'
,
borderTopLeftRadius
:
32
,
borderTopRightRadius
:
32
}
}
>
{
this
.
state
.
listCategory
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'ListSearchScreen'
)}
style
=
{{
marginTop
:
index
==
0
?
0
:
15
,
marginBottom
:
index
==
this
.
state
.
listCategory
.
length
-
1
?
50
:
0
,
elevation
:
2
,
borderRadius
:
15
}}
key
=
{
index
}
>
<
TouchableOpacity
<
Image
source
=
{
item
}
style
=
{{
width
:
'100%'
,
height
:
100
,
borderRadius
:
10
,
resizeMode
:
'stretch'
}}
/
>
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
})}
>
<
BaseText
type
=
{
"bold"
}
text
=
{
item
.
title
}
style
=
{{
fontSize
:
16
,
color
:
'white'
,
marginTop
:
5
,
alignSelf
:
'center'
}}
/
>
<
View
style
=
{{}}
>
<
Image
source
=
{{
uri
:
item
.
category_image
}}
style
=
{{
height
:
90
,
width
:
90
}}
/
>
<
/View
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
)
)
})}
})}
...
...
App/Containers/ListSearchScreen.js
View file @
c6cf0b5d
This diff is collapsed.
Click to expand it.
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