Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_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
new_excelso
Commits
68612dd5
Commit
68612dd5
authored
May 15, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notification sekarang bisa navigate
parent
7446a597
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
30 deletions
+50
-30
App.js
App.js
+43
-30
RootNavigation.js
helper/RootNavigation.js
+7
-0
No files found.
App.js
View file @
68612dd5
...
@@ -17,6 +17,9 @@ import { AppLoading, Notifications } from 'expo';
...
@@ -17,6 +17,9 @@ import { AppLoading, Notifications } from 'expo';
import
*
as
Font
from
'expo-font'
;
import
*
as
Font
from
'expo-font'
;
import
*
as
Sentry
from
'sentry-expo'
;
import
*
as
Sentry
from
'sentry-expo'
;
import
Constants
from
'expo-constants'
;
import
Constants
from
'expo-constants'
;
import
{
navigationRef
}
from
'./helper/RootNavigation'
;
import
*
as
RootNavigation
from
'./helper/RootNavigation'
;
Sentry
.
init
({
Sentry
.
init
({
dsn
:
'https://ae2449ac801244d99f170140c7cd6d0a@o392471.ingest.sentry.io/5239999'
,
dsn
:
'https://ae2449ac801244d99f170140c7cd6d0a@o392471.ingest.sentry.io/5239999'
,
...
@@ -58,42 +61,52 @@ export default function App() {
...
@@ -58,42 +61,52 @@ export default function App() {
await
Font
.
loadAsync
(
customFonts
);
await
Font
.
loadAsync
(
customFonts
);
};
};
const
handleNotification
=
notification
=>
{
const
routing
=
(
data
)
=>
{
Vibration
.
vibrate
();
if
(
data
.
action_type
==
'Rewards'
)
{
console
.
log
(
'Notification Payload Data : '
+
JSON
.
stringify
(
notification
.
data
))
RootNavigation
.
navigate
(
'Reward Detail'
,
{
rewardId
:
data
.
data_id
});
const
data
=
notification
.
data
;
}
else
if
(
data
.
action_type
==
'Inbox'
)
{
Alert
.
alert
(
data
.
title
,
data
.
body
,
[
{
text
:
'Close'
,
onPress
:
()
=>
console
.
log
(
'Close'
),
style
:
'cancel'
,
},
{
text
:
'View'
,
onPress
:
()
=>
{
console
.
log
(
'Pindah Halaman'
)
if
(
data
.
action_type
==
'Rewards'
)
{
// props.navigation.navigate('Reward Detail', { rewardId: data.data_id })
}
else
if
(
data
.
action_type
==
'Inbox'
)
{
}
else
if
(
data
.
action_type
==
'Transaction'
)
{
}
else
if
(
data
.
action_type
==
'Transaction'
)
{
RootNavigation
.
navigate
(
'Transaction Detail'
,
{
idTrans
:
data
.
data_id
});
}
else
if
(
data
.
action_type
==
'Review'
)
{
}
else
if
(
data
.
action_type
==
'Rev
iew'
)
{
}
else
if
(
data
.
action_type
==
'WebV
iew'
)
{
}
else
if
(
data
.
action_type
==
'WebView
'
)
{
}
else
if
(
data
.
action_type
==
'Transfer Receive
'
)
{
}
else
if
(
data
.
action_type
==
'Transfer Receive
'
)
{
}
else
if
(
data
.
action_type
==
'Cashback
'
)
{
}
else
if
(
data
.
action_type
==
'Cashback'
)
{
}
}
const
handleNotification
=
notification
=>
{
// console.log('Notification Origin : ' + JSON.stringify(notification.origin))
// console.log('Notification Payload Data : ' + JSON.stringify(notification.data))
const
origin
=
notification
.
origin
;
const
data
=
notification
.
data
;
if
(
origin
==
'selected'
)
{
routing
(
data
)
}
else
{
Vibration
.
vibrate
();
Alert
.
alert
(
data
.
title
,
data
.
body
,
[
{
text
:
'Close'
,
style
:
'cancel'
,
},
{
text
:
'View'
,
onPress
:
()
=>
{
routing
(
data
)
}
}
}
},
},
],
],
{
cancelable
:
false
},
{
cancelable
:
false
},
)
)
}
}
}
...
@@ -111,7 +124,7 @@ export default function App() {
...
@@ -111,7 +124,7 @@ export default function App() {
return
(
return
(
<
Provider
store
=
{
store
}
>
<
Provider
store
=
{
store
}
>
<
PersistGate
loading
=
{
null
}
persistor
=
{
persistor
}
>
<
PersistGate
loading
=
{
null
}
persistor
=
{
persistor
}
>
<
NavigationContainer
>
<
NavigationContainer
ref
=
{
navigationRef
}
>
<
Auth
/>
<
Auth
/>
<
/NavigationContainer
>
<
/NavigationContainer
>
<
/PersistGate
>
<
/PersistGate
>
...
...
helper/RootNavigation.js
0 → 100644
View file @
68612dd5
import
*
as
React
from
'react'
;
export
const
navigationRef
=
React
.
createRef
();
export
function
navigate
(
name
,
params
)
{
navigationRef
.
current
?.
navigate
(
name
,
params
);
}
\ No newline at end of file
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