Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Giang Tran
InvestCustomer
Commits
fbce9686
Commit
fbce9686
authored
3 years ago
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug home
parent
9f568dc5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
166 additions
and
166 deletions
+166
-166
Podfile
ios/Podfile
+1
-1
Home.js
src/Screens/Home/Home.js
+14
-17
HomeView.js
src/Screens/Home/HomeView.js
+5
-1
TabNavigation.js
src/routers/TabNavigation.js
+146
-147
No files found.
ios/Podfile
View file @
fbce9686
...
...
@@ -8,7 +8,7 @@ def add_flipper_pods!(versions = {})
versions
[
'Flipper-Glog'
]
||=
'0.3.6'
versions
[
'Flipper-PeerTalk'
]
||=
'~> 0.0.4'
versions
[
'Flipper-RSocket'
]
||=
'~> 1.0'
pod
'FlipperKit'
,
versions
[
'Flipper'
],
:configuration
=>
'Debug'
pod
'FlipperKit/FlipperKitLayoutPlugin'
,
versions
[
'Flipper'
],
:configuration
=>
'Debug'
pod
'FlipperKit/SKIOSNetworkPlugin'
,
versions
[
'Flipper'
],
:configuration
=>
'Debug'
...
...
This diff is collapsed.
Click to expand it.
src/Screens/Home/Home.js
View file @
fbce9686
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Alert
,
Platform
}
from
'react-native'
;
import
{
Alert
,
Platform
,
View
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
getTransaction
}
from
'../../apis/Functions/users'
;
import
{
getImagesHome
}
from
'../../apis/Functions/General'
;
...
...
@@ -180,24 +180,21 @@ const Home = (props) => {
};
return
(
<>
<
HomeView
data
=
{
data
}
dataPrice
=
{
dataPriceFilter
}
listImage
=
{
listImage
}
filterId
=
{
filterId
}
filters
=
{
filters
}
setFilterId
=
{
changeFilter
}
onSortByName
=
{
onSortByName
}
onSortByPercent
=
{
onSortByPercent
}
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
/
>
<
VersionChecker
/>
<
/
>
<
HomeView
data
=
{
data
}
dataPrice
=
{
dataPriceFilter
}
listImage
=
{
listImage
}
filterId
=
{
filterId
}
filters
=
{
filters
}
setFilterId
=
{
changeFilter
}
onSortByName
=
{
onSortByName
}
onSortByPercent
=
{
onSortByPercent
}
onSortByPriceOpenClose
=
{
onSortByPriceOpenClose
}
onSortByPriceHighLow
=
{
onSortByPriceHighLow
}
/
>
);
};
<
VersionChecker
/>
;
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
...
...
This diff is collapsed.
Click to expand it.
src/Screens/Home/HomeView.js
View file @
fbce9686
...
...
@@ -4,13 +4,15 @@ import {
ImageBackground
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Text
,
}
from
'react-native'
;
import
HeaderHome
from
'../../components/Header/HeaderHome'
;
import
{
getFontXD
}
from
'../../Config/Functions'
;
import
R
from
'../../assets/R'
;
import
SwiperComponent
from
'./SwiperComponent'
;
import
PriceListView
from
'./PriceListView'
;
import
VersionChecker
from
'../VersionChecker'
;
const
HomeView
=
(
props
)
=>
{
return
(
<
ImageBackground
...
...
@@ -34,6 +36,8 @@ const HomeView = (props) => {
onSortByPriceOpenClose
=
{
props
.
onSortByPriceOpenClose
}
onSortByPriceHighLow
=
{
props
.
onSortByPriceHighLow
}
/
>
<
VersionChecker
/>
<
/ScrollView
>
<
/ImageBackground
>
);
...
...
This diff is collapsed.
Click to expand it.
src/routers/TabNavigation.js
View file @
fbce9686
...
...
@@ -28,160 +28,159 @@ import {getHeight, getWidth, logout} from '../Config/Functions';
const
Tab
=
createBottomTabNavigator
();
const
PayScreenComponent
=
()
=>
{
return
null
;
return
null
;
};
const
TabNavigator
=
(
props
)
=>
{
console
.
log
(
getHeight
(),
getWidth
());
const
navigate
=
useNavigation
();
useEffect
(()
=>
{
setInitLanguage
();
checkDeepking
();
setTimeout
(()
=>
{
showPopUp
();
},
3000
);
let
logoutListener
=
DeviceEventEmitter
.
addListener
(
'logout'
,
(
e
)
=>
{
console
.
log
(
'run in to logout'
);
logout
(
navigate
);
});
return
()
=>
{
logoutListener
.
remove
();
};
},
[]);
const
checkDeepking
=
()
=>
{
Linking
.
getInitialURL
().
then
((
url
)
=>
{
if
(
url
)
{
deeplinkScreen
(
url
);
}
});
Linking
.
addEventListener
(
'url'
,
(
url
)
=>
{
if
(
url
)
{
handleOpenURL
(
url
);
}
});
};
const
handleOpenURL
=
(
event
)
=>
{
deeplinkScreen
(
event
.
url
);
};
const
deeplinkScreen
=
(
url
)
=>
{
const
route
=
url
.
replace
(
/.*
?
:
\/\/
/g
,
''
);
const
id
=
route
.
match
(
/
\/([^\/]
+
)\/?
$/
)[
1
];
const
root
=
route
.
split
(
'/'
)[
0
];
// const routeName = route.split('/')[1];
if
(
root
==
'screen'
)
{
navigate
.
navigate
(
DETAILNEW
,
{
id
});
}
};
useEffect
(()
=>
{
checkScreenInit
();
},
[
props
.
screenInit
]);
const
checkScreenInit
=
()
=>
{
if
(
props
.
screenInit
.
screen
)
{
const
{
screen
,
id
}
=
props
.
screenInit
;
navigate
.
navigate
(
screen
,
{
id
:
id
});
}
console
.
log
(
getHeight
(),
getWidth
());
const
navigate
=
useNavigation
();
useEffect
(()
=>
{
setInitLanguage
();
checkDeepking
();
setTimeout
(()
=>
{
showPopUp
();
},
3000
);
let
logoutListener
=
DeviceEventEmitter
.
addListener
(
'logout'
,
(
e
)
=>
{
console
.
log
(
'run in to logout'
);
logout
(
navigate
);
});
return
()
=>
{
logoutListener
.
remove
();
};
const
setInitLanguage
=
async
()
=>
{
const
laguage
=
await
AsyncStorage
.
getItem
(
KEY
.
LANGUAGE
);
if
(
laguage
)
{
props
.
changeLanguage
(
laguage
);
}
setLocation
(
I18n
,
laguage
);
};
const
showPopUp
=
()
=>
{
if
(
props
.
user
.
status
==
1
)
{
return
confirmAlert
(
I18n
.
t
(
'PopupVerifyAccount'
),
()
=>
{
navigate
.
navigate
(
AccountVerification
);
});
}
else
if
(
props
.
user
.
status
==
3
&&
!
props
.
user
.
contract_code
)
{
return
confirmAlert
(
I18n
.
t
(
'PopupOpenCQG'
),
()
=>
{
navigate
.
navigate
(
PACKETCQG
);
});
}
};
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
Tab
.
Navigator
initialRouteName
=
"Screen1"
tabBarOptions
=
{{
activeTintColor
:
R
.
colors
.
main
}}
>
<
Tab
.
Screen
name
=
"Screen1"
component
=
{
Home
}
options
=
{{
tabBarLabel
:
'Overview'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Icon
name
=
"landmark"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Screen2"
component
=
{
Transaction
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Giao dịch'
:
'Tradding'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Image
source
=
{
R
.
images
.
iconTransaction2
}
style
=
{{
width
:
size
,
height
:
size
,
tintColor
:
color
}}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Pay"
component
=
{
PayScreenComponent
}
options
=
{{
tabBarButton
:
()
=>
<
PlussModal
/>
,
}}
/
>
<
Tab
.
Screen
name
=
"Screen3"
component
=
{
Notification
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Thông báo'
:
'Notification'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Ionicons
name
=
"ios-notifications-outline"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Screen4"
component
=
{
NewFeed
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Tin tức'
:
'News'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Ionicons
name
=
"newspaper-outline"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
/Tab.Navigator
>
<
/View
>
);
},
[]);
const
checkDeepking
=
()
=>
{
Linking
.
getInitialURL
().
then
((
url
)
=>
{
if
(
url
)
{
deeplinkScreen
(
url
);
}
});
Linking
.
addEventListener
(
'url'
,
(
url
)
=>
{
if
(
url
)
{
handleOpenURL
(
url
);
}
});
};
const
handleOpenURL
=
(
event
)
=>
{
deeplinkScreen
(
event
.
url
);
};
const
deeplinkScreen
=
(
url
)
=>
{
const
route
=
url
.
replace
(
/.*
?
:
\/\/
/g
,
''
);
const
id
=
route
.
match
(
/
\/([^\/]
+
)\/?
$/
)[
1
];
const
root
=
route
.
split
(
'/'
)[
0
];
// const routeName = route.split('/')[1];
if
(
root
==
'screen'
)
{
navigate
.
navigate
(
DETAILNEW
,
{
id
});
}
};
useEffect
(()
=>
{
checkScreenInit
();
},
[
props
.
screenInit
]);
const
checkScreenInit
=
()
=>
{
if
(
props
.
screenInit
.
screen
)
{
const
{
screen
,
id
}
=
props
.
screenInit
;
navigate
.
navigate
(
screen
,
{
id
:
id
});
}
};
const
setInitLanguage
=
async
()
=>
{
const
laguage
=
await
AsyncStorage
.
getItem
(
KEY
.
LANGUAGE
);
if
(
laguage
)
{
props
.
changeLanguage
(
laguage
);
}
setLocation
(
I18n
,
laguage
);
};
const
showPopUp
=
()
=>
{
if
(
props
.
user
.
status
==
1
)
{
return
confirmAlert
(
I18n
.
t
(
'PopupVerifyAccount'
),
()
=>
{
navigate
.
navigate
(
AccountVerification
);
});
}
else
if
(
props
.
user
.
status
==
3
&&
!
props
.
user
.
contract_code
)
{
return
confirmAlert
(
I18n
.
t
(
'PopupOpenCQG'
),
()
=>
{
navigate
.
navigate
(
PACKETCQG
);
});
}
};
return
(
<
View
style
=
{{
flex
:
1
}}
>
<
Tab
.
Navigator
initialRouteName
=
"Screen1"
tabBarOptions
=
{{
activeTintColor
:
R
.
colors
.
main
}}
>
<
Tab
.
Screen
name
=
"Screen1"
component
=
{
Home
}
options
=
{{
tabBarLabel
:
'Overview'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Icon
name
=
"landmark"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Screen2"
component
=
{
Transaction
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Giao dịch'
:
'Tradding'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Image
source
=
{
R
.
images
.
iconTransaction2
}
style
=
{{
width
:
size
,
height
:
size
,
tintColor
:
color
}}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Pay"
component
=
{
PayScreenComponent
}
options
=
{{
tabBarButton
:
()
=>
<
PlussModal
/>
,
}}
/
>
<
Tab
.
Screen
name
=
"Screen3"
component
=
{
Notification
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Thông báo'
:
'Notification'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Ionicons
name
=
"ios-notifications-outline"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
Tab
.
Screen
name
=
"Screen4"
component
=
{
NewFeed
}
options
=
{{
tabBarLabel
:
props
.
language
.
language
==
'vi'
?
'Tin tức'
:
'News'
,
tabBarIcon
:
({
color
,
size
})
=>
(
<
Ionicons
name
=
"newspaper-outline"
size
=
{
size
}
color
=
{
color
}
/
>
),
}}
/
>
<
/Tab.Navigator
>
<
/View
>
);
};
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
notifi
:
state
.
CountNotificationReducer
,
screenInit
:
state
.
ScreenInitReducer
,
language
:
state
.
languageReducer
,
};
return
{
user
:
state
.
userReducer
,
notifi
:
state
.
CountNotificationReducer
,
screenInit
:
state
.
ScreenInitReducer
,
language
:
state
.
languageReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{
changeLanguage
})(
TabNavigator
);
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