Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_excelso
Project
Project
Details
Activity
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
Prasetya Saputra
clone_excelso
Commits
d785154c
Commit
d785154c
authored
May 18, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
news detail
parent
fe4cca37
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
32 deletions
+106
-32
Auth.js
view/Auth.js
+1
-1
Home.js
view/Home.js
+24
-14
NewsDetail.js
view/NewsDetail.js
+81
-17
No files found.
view/Auth.js
View file @
d785154c
...
@@ -378,7 +378,7 @@ class Auth extends React.Component {
...
@@ -378,7 +378,7 @@ class Auth extends React.Component {
<
Stack
.
Screen
name
=
"Transaction Detail"
component
=
{
TransactionDetail
}
/
>
<
Stack
.
Screen
name
=
"Transaction Detail"
component
=
{
TransactionDetail
}
/
>
{
/* <Stack.Screen name="Email Confirmation" component={EmailConfirmation} /> */
}
{
/* <Stack.Screen name="Email Confirmation" component={EmailConfirmation} /> */
}
<
Stack
.
Screen
name
=
"News Detail"
component
=
{
NewsDetail
}
/
>
<
Stack
.
Screen
name
=
"News Detail"
component
=
{
NewsDetail
}
options
=
{{
headerShown
:
false
}}
/
>
<
Stack
.
Screen
name
=
"Confirm Your Order"
component
=
{
MenuConfirmation
}
/
>
<
Stack
.
Screen
name
=
"Confirm Your Order"
component
=
{
MenuConfirmation
}
/
>
<
Stack
.
Screen
name
=
"Date Time"
component
=
{
DateTime
}
/
>
<
Stack
.
Screen
name
=
"Date Time"
component
=
{
DateTime
}
/
>
<
Stack
.
Screen
name
=
"New Register"
component
=
{
NewRegister
}
<
Stack
.
Screen
name
=
"New Register"
component
=
{
NewRegister
}
...
...
view/Home.js
View file @
d785154c
import
{
SimpleLineIcons
}
from
'@expo/vector-icons'
;
import
Axios
from
'axios'
;
import
*
as
Device
from
'expo-device'
;
import
*
as
Location
from
'expo-location'
;
import
*
as
Permissions
from
'expo-permissions'
;
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Alert
,
ActivityIndicator
}
from
'react-native'
;
import
{
ActivityIndicator
,
Alert
,
Dimensions
,
ScrollView
,
StyleSheet
,
Text
,
TouchableOpacity
,
View
}
from
'react-native'
;
import
{
Ionicons
,
MaterialCommunityIcons
,
SimpleLineIcons
}
from
'@expo/vector-icons'
;
import
{
SliderBox
}
from
"react-native-image-slider-box"
;
import
{
SliderBox
}
from
"react-native-image-slider-box"
;
import
{
Card
}
from
'react-native-shadow-cards'
;
import
{
Card
}
from
'react-native-shadow-cards'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
import
i18n
from
'i18n-js'
;
import
_
from
'lodash'
;
import
*
as
Location
from
'expo-location'
;
import
*
as
Permissions
from
'expo-permissions'
;
import
*
as
Device
from
'expo-device'
;
import
ActionType
from
'../redux/globalActionType'
;
import
session
from
'../function/session'
;
import
Constants
from
'expo-constants'
;
import
info
from
'../app.json'
;
import
info
from
'../app.json'
;
import
session
from
'../function/session'
;
import
ActionType
from
'../redux/globalActionType'
;
let
version
=
info
.
expo
.
version
let
version
=
info
.
expo
.
version
...
@@ -32,11 +29,17 @@ class Home extends React.Component {
...
@@ -32,11 +29,17 @@ class Home extends React.Component {
account_number
:
""
,
account_number
:
""
,
my_lat
:
0
,
my_lat
:
0
,
my_long
:
0
,
my_long
:
0
,
indicator
:
true
indicator
:
true
,
slider_height
:
350
,
slugs
:
[]
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
const
screenWidth
=
Math
.
round
(
Dimensions
.
get
(
'window'
).
width
);
this
.
setState
({
slider_height
:
screenWidth
})
this
.
_account
();
this
.
_account
();
this
.
_getPermissions
()
this
.
_getPermissions
()
this
.
_renderCarousell
()
this
.
_renderCarousell
()
...
@@ -99,13 +102,16 @@ class Home extends React.Component {
...
@@ -99,13 +102,16 @@ class Home extends React.Component {
Axios
.
get
(
'https://excelsocrm.ravintoladev.com/cms/v2/list/promotions-carousel'
).
then
(
respon
=>
{
Axios
.
get
(
'https://excelsocrm.ravintoladev.com/cms/v2/list/promotions-carousel'
).
then
(
respon
=>
{
const
dataCarousell
=
respon
.
data
.
contents
;
const
dataCarousell
=
respon
.
data
.
contents
;
let
imageLink
=
[]
let
imageLink
=
[]
let
slugs
=
[]
for
(
let
i
=
0
;
i
<
dataCarousell
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
dataCarousell
.
length
;
i
++
)
{
const
element
=
dataCarousell
[
i
];
const
element
=
dataCarousell
[
i
];
imageLink
.
push
(
element
.
title_thumb
)
imageLink
.
push
(
element
.
title_thumb
)
slugs
.
push
(
element
.
slug
)
}
}
this
.
setState
({
this
.
setState
({
images
:
imageLink
images
:
imageLink
,
slugs
:
slugs
})
})
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
@@ -215,13 +221,14 @@ class Home extends React.Component {
...
@@ -215,13 +221,14 @@ class Home extends React.Component {
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{{
backgroundColor
:
'red'
}}
>
<
SliderBox
<
SliderBox
images
=
{
this
.
state
.
images
}
images
=
{
this
.
state
.
images
}
autoplay
autoplay
circleLoop
circleLoop
dotColor
=
'black'
dotColor
=
'black'
inactiveDotColor
=
'white'
inactiveDotColor
=
'white'
sliderBoxHeight
=
{
300
}
sliderBoxHeight
=
{
this
.
state
.
slider_height
}
paginationBoxVerticalPadding
=
{
20
}
paginationBoxVerticalPadding
=
{
20
}
resizeMethod
=
{
'resize'
}
resizeMethod
=
{
'resize'
}
resizeMode
=
{
'stretch'
}
resizeMode
=
{
'stretch'
}
...
@@ -246,8 +253,11 @@ class Home extends React.Component {
...
@@ -246,8 +253,11 @@ class Home extends React.Component {
width
:
'100%'
,
width
:
'100%'
,
}}
}}
imageLoadingColor
=
'#c7c7c7'
imageLoadingColor
=
'#c7c7c7'
onCurrentImagePressed
=
{(
index
)
=>
this
.
props
.
navigation
.
navigate
(
'News Detail'
,
{
slug
:
this
.
state
.
slugs
[
index
]})}
/
>
/
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
content
}
>
<
View
style
=
{
styles
.
content
}
>
<
View
style
=
{
styles
.
card
}
>
<
View
style
=
{
styles
.
card
}
>
<
Card
>
<
Card
>
...
...
view/NewsDetail.js
View file @
d785154c
import
React
from
'react'
;
import
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
Dimensions
}
from
'react-native'
;
import
{
Image
}
from
'react-native-elements'
;
import
Axios
from
'axios'
;
import
{
TouchableOpacity
,
ScrollView
}
from
'react-native-gesture-handler'
;
import
HTML
from
'react-native-render-html'
;
export
default
class
NewsDetail
extends
React
.
Component
{
export
default
class
NewsDetail
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
title
:
''
,
subtitle
:
''
,
image
:
''
,
content
:
''
,
image_height
:
400
}
}
componentDidMount
()
{
const
screenWidth
=
Math
.
round
(
Dimensions
.
get
(
'window'
).
width
);
this
.
setState
({
image_height
:
screenWidth
})
this
.
get_news_detail
(
this
.
props
.
route
.
params
.
slug
)
}
get_news_detail
(
slug
)
{
Axios
.
get
(
'https://excelsocrm.ravintoladev.com/cms/v2/detail/'
+
slug
).
then
(
res
=>
{
// console.log(JSON.stringify(res.data))
const
detail
=
res
.
data
;
this
.
setState
({
title
:
detail
.
title
,
subtitle
:
detail
.
subtitle
,
image
:
detail
.
content_image
,
content
:
detail
.
content
,
})
})
}
render
()
{
render
()
{
console
.
log
(
'Image : '
+
this
.
state
.
image
)
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
header
}
>
<
View
style
=
{
styles
.
header
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
margin
:
20
,
fontSize
:
25
,
alignSelf
:
'center'
}}
>
News
Detail
<
/Text
>
<
TouchableOpacity
>
<
Image
source
=
{
require
(
'../assets/icon/back.png'
)}
style
=
{{
width
:
35
,
height
:
35
}}
/
>
<
/TouchableOpacity
>
<
Text
style
=
{
styles
.
headerTitle
}
>
NEWS
DETAIL
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
body
}
>
<
Scroll
View
style
=
{
styles
.
body
}
>
<
View
style
=
{
styles
.
image
s
}
>
<
View
style
=
{
styles
.
image
_container
(
this
.
state
.
image_height
)
}
>
<
Image
style
=
{
styles
.
image
(
this
.
state
.
image_height
)}
source
=
{
this
.
state
.
image
?
{
uri
:
this
.
state
.
image
}
:
null
}
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
content
}
>
<
View
style
=
{
styles
.
content
}
>
<
Text
style
=
{
{
margin
:
10
,
fontSize
:
20
}}
>
Judul
:
<
/Text
>
<
Text
style
=
{
styles
.
title
}
>
{
this
.
state
.
title
}
<
/Text
>
<
Text
style
=
{{
margin
:
10
,
fontSize
:
20
}}
>
Keterangan
:
<
/Text
>
<
View
style
=
{{
backgroundColor
:
'#adadad'
,
height
:
1.5
,
flex
:
1
}}
/
>
<
/View
>
<
HTML
html
=
{
this
.
state
.
content
}
/
>
<
/View
>
<
/View
>
<
/ScrollView
>
<
/View
>
<
/View
>
)
)
}
}
...
@@ -27,22 +68,45 @@ export default class NewsDetail extends React.Component {
...
@@ -27,22 +68,45 @@ export default class NewsDetail extends React.Component {
const
styles
=
StyleSheet
.
create
({
const
styles
=
StyleSheet
.
create
({
container
:
{
container
:
{
flex
:
1
,
flex
:
1
,
marginTop
:
29
,
backgroundColor
:
'white'
,
backgroundColor
:
'white'
,
},
},
header
:
{
header
:
{
height
:
60
,
flex
:
0.5
,
paddingHorizontal
:
10
,
flexDirection
:
'row'
,
backgroundColor
:
'#CFB368'
,
alignItems
:
'center'
},
},
images
:
{
headerTitle
:
{
margin
:
10
,
flex
:
1
,
flex
:
2
,
textAlign
:
'center'
,
backgroundColor
:
'green'
margin
:
20
,
fontSize
:
23
,
alignSelf
:
'center'
,
color
:
'white'
,
fontFamily
:
'Gotham-Black'
},
image_container
:
(
height
)
=>
({
height
:
height
,
backgroundColor
:
'gray'
}),
image
:
(
height
)
=>
({
width
:
'100%'
,
height
:
height
}),
title
:
{
textAlign
:
'center'
,
fontFamily
:
'Gotham-Black'
,
fontSize
:
22
,
marginBottom
:
10
,
color
:
'#CFB368'
},
},
content
:
{
content
:
{
flex
:
2
,
paddingHorizontal
:
25
,
paddingVertical
:
30
},
},
body
:
{
body
:
{
flex
:
3
,
}
},
})
})
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