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
40145286
Commit
40145286
authored
Jul 03, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nambah di tab bar try catch
parent
48041380
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
79 deletions
+89
-79
Auth.js
view/Auth.js
+89
-79
No files found.
view/Auth.js
View file @
40145286
...
@@ -69,75 +69,80 @@ enableScreens();
...
@@ -69,75 +69,80 @@ enableScreens();
const
Tab
=
createBottomTabNavigator
();
const
Tab
=
createBottomTabNavigator
();
const
BottomNavigation
=
({
state
,
descriptors
,
navigation
})
=>
{
const
BottomNavigation
=
({
state
,
descriptors
,
navigation
})
=>
{
const
insets
=
useSafeArea
();
try
{
let
paddingBottom
=
0
;
const
insets
=
useSafeArea
();
if
(
Platform
.
OS
===
'ios'
)
{
let
paddingBottom
=
0
;
paddingBottom
=
insets
.
bottom
;
if
(
Platform
.
OS
===
'ios'
)
{
}
paddingBottom
=
insets
.
bottom
;
return
(
}
<
View
style
=
{{
flexDirection
:
'row'
,
paddingBottom
:
paddingBottom
}}
>
return
(
{
state
.
routes
.
map
((
route
,
index
)
=>
{
<
View
style
=
{{
flexDirection
:
'row'
,
paddingBottom
:
paddingBottom
}}
>
const
{
options
}
=
descriptors
[
route
.
key
];
{
state
.
routes
.
map
((
route
,
index
)
=>
{
const
label
=
const
{
options
}
=
descriptors
[
route
.
key
];
options
.
tabBarLabel
!==
undefined
const
label
=
?
options
.
tabBarLabel
options
.
tabBarLabel
!==
undefined
:
options
.
title
!==
undefined
?
options
.
tabBarLabel
?
options
.
title
:
options
.
title
!==
undefined
:
route
.
name
;
?
options
.
title
:
route
.
name
;
const
isFocused
=
state
.
index
===
index
;
const
isFocused
=
state
.
index
===
index
;
const
onPress
=
()
=>
{
const
event
=
navigation
.
emit
({
const
onPress
=
()
=>
{
type
:
'tabPress'
,
const
event
=
navigation
.
emit
({
target
:
route
.
key
,
type
:
'tabPress'
,
canPreventDefault
:
true
,
target
:
route
.
key
,
});
canPreventDefault
:
true
,
});
if
(
!
isFocused
&&
!
event
.
defaultPrevented
)
{
navigation
.
navigate
(
route
.
name
);
if
(
!
isFocused
&&
!
event
.
defaultPrevented
)
{
navigation
.
navigate
(
route
.
name
);
}
};
const
onLongPress
=
()
=>
{
navigation
.
emit
({
type
:
'tabLongPress'
,
target
:
route
.
key
,
});
};
let
icon
=
require
(
'../assets/icon/icon-home.png'
)
if
(
label
===
'HOME'
)
{
icon
=
require
(
'../assets/icon/icon-home.png'
)
}
else
if
(
label
===
'MENU'
)
{
icon
=
require
(
'../assets/icon/icon-menu.png'
)
}
else
if
(
label
===
'REWARDS'
)
{
icon
=
require
(
'../assets/icon/icon-rewards.png'
)
}
else
if
(
label
===
'ORDER'
)
{
icon
=
require
(
'../assets/icon/icon-order.png'
)
}
else
if
(
label
===
'OUTLETS'
)
{
icon
=
require
(
'../assets/icon/icon-outlets.png'
)
}
else
if
(
label
===
'ACCOUNT'
)
{
icon
=
require
(
'../assets/icon/icon-account.png'
)
}
}
};
return
(
const
onLongPress
=
()
=>
{
<
TouchableOpacity
navigation
.
emit
({
key
=
{
route
.
name
}
type
:
'tabLongPress'
,
accessibilityRole
=
"button"
target
:
route
.
key
,
accessibilityStates
=
{
isFocused
?
[
'selected'
]
:
[]}
});
accessibilityLabel
=
{
options
.
tabBarAccessibilityLabel
}
};
testID
=
{
options
.
tabBarTestID
}
onPress
=
{
onPress
}
let
icon
=
require
(
'../assets/icon/icon-home.png'
)
onLongPress
=
{
onLongPress
}
if
(
label
===
'HOME'
)
{
style
=
{{
flex
:
1
,
alignItems
:
'center'
,
backgroundColor
:
'white'
,
borderTopWidth
:
1
,
borderTopColor
:
'#f0f0f0'
}}
icon
=
require
(
'../assets/icon/icon-home.png'
)
>
}
else
if
(
label
===
'MENU'
)
{
<
Image
source
=
{
icon
}
style
=
{{
height
:
50
,
width
:
50
,
tintColor
:
isFocused
?
'#CFB368'
:
'gray'
}}
/
>
icon
=
require
(
'../assets/icon/icon-menu.png'
)
<
/TouchableOpacity
>
}
else
if
(
label
===
'REWARDS'
)
{
);
icon
=
require
(
'../assets/icon/icon-rewards.png'
)
})}
}
else
if
(
label
===
'ORDER'
)
{
<
/View
>
icon
=
require
(
'../assets/icon/icon-order.png'
)
)
}
else
if
(
label
===
'OUTLETS'
)
{
}
catch
(
error
)
{
icon
=
require
(
'../assets/icon/icon-outlets.png'
)
Alert
.
alert
(
'Error '
+
error
)
}
else
if
(
label
===
'ACCOUNT'
)
{
}
icon
=
require
(
'../assets/icon/icon-account.png'
)
}
return
(
<
TouchableOpacity
key
=
{
route
.
name
}
accessibilityRole
=
"button"
accessibilityStates
=
{
isFocused
?
[
'selected'
]
:
[]}
accessibilityLabel
=
{
options
.
tabBarAccessibilityLabel
}
testID
=
{
options
.
tabBarTestID
}
onPress
=
{
onPress
}
onLongPress
=
{
onLongPress
}
style
=
{{
flex
:
1
,
alignItems
:
'center'
,
backgroundColor
:
'white'
,
borderTopWidth
:
1
,
borderTopColor
:
'#f0f0f0'
}}
>
<
Image
source
=
{
icon
}
style
=
{{
height
:
50
,
width
:
50
,
tintColor
:
isFocused
?
'#CFB368'
:
'gray'
}}
/
>
<
/TouchableOpacity
>
);
})}
<
/View
>
)
}
}
function
HandleInbox
({
navigation
})
{
function
HandleInbox
({
navigation
})
{
...
@@ -151,17 +156,22 @@ function HandleInbox({ navigation }) {
...
@@ -151,17 +156,22 @@ function HandleInbox({ navigation }) {
}
}
function
HomePage
({
navigation
})
{
function
HomePage
({
navigation
})
{
return
(
try
{
<
Tab
.
Navigator
tabBar
=
{
props
=>
<
BottomNavigation
{...
props
}
/>
}
return
(
>
<
Tab
.
Navigator
tabBar
=
{
props
=>
<
BottomNavigation
{...
props
}
/>
}
<
Tab
.
Screen
name
=
"HOME"
component
=
{
Home
}
/
>
>
<
Tab
.
Screen
name
=
"MENU"
component
=
{
MenuSelection
}
/
>
<
Tab
.
Screen
name
=
"HOME"
component
=
{
Home
}
/
>
<
Tab
.
Screen
name
=
"REWARDS"
component
=
{
RewardsList
}
/
>
<
Tab
.
Screen
name
=
"MENU"
component
=
{
MenuSelection
}
/
>
<
Tab
.
Screen
name
=
"ORDER"
component
=
{
OrderHistory
}
/
>
<
Tab
.
Screen
name
=
"REWARDS"
component
=
{
RewardsList
}
/
>
<
Tab
.
Screen
name
=
"OUTLETS"
component
=
{
Outlets
}
/
>
<
Tab
.
Screen
name
=
"ORDER"
component
=
{
OrderHistory
}
/
>
<
Tab
.
Screen
name
=
"ACCOUNT"
component
=
{
Account
}
/
>
<
Tab
.
Screen
name
=
"OUTLETS"
component
=
{
Outlets
}
/
>
<
/Tab.Navigator
>
<
Tab
.
Screen
name
=
"ACCOUNT"
component
=
{
Account
}
/
>
);
<
/Tab.Navigator
>
);
}
catch
(
error
)
{
Alert
.
alert
(
'Error : '
+
error
)
}
}
}
const
Stack
=
createStackNavigator
();
const
Stack
=
createStackNavigator
();
class
Auth
extends
React
.
Component
{
class
Auth
extends
React
.
Component
{
...
...
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