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
9710396e
Commit
9710396e
authored
May 10, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update avatart
parent
e00ac231
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
PickerAvatart.js
src/components/Picker/PickerAvatart.js
+16
-10
No files found.
src/components/Picker/PickerAvatart.js
View file @
9710396e
...
...
@@ -20,7 +20,7 @@ import {connect} from 'react-redux';
import
{
saveUserToRedux
}
from
'../../actions/users'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
TABNAVIGATOR
}
from
'../../routers/ScreenNames'
;
import
{
changeAvatart
}
from
'../../apis/Functions/users'
;
const
options
=
{
...
...
@@ -35,15 +35,14 @@ const options = {
const
PickerImg
=
(
props
)
=>
{
const
naviagtion
=
useNavigation
();
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
imgAvatart
,
setImgAvatart
]
=
useState
(
props
.
user
.
picture_url
);
//
const [imgAvatart, setImgAvatart] = useState(props.user.picture_url);
console
.
log
(
props
.
user
);
useEffect
(()
=>
{
setTimeout
(()
=>
{
console
.
log
(
'Affter'
,
props
.
user
.
picture_url
);
setImgAvatart
(
props
.
user
.
picture_url
);
},
500
);
},
[
props
.
user
]);
// useEffect(() => {
// setTimeout(() => {
// console.log('Affter', props.user.picture_url);
// setImgAvatart(props.user.picture_url);
// }, 500);
// }, [props.user]);
const
createFormData
=
(
photo
,
body
)
=>
{
const
data
=
new
FormData
();
...
...
@@ -65,6 +64,10 @@ const PickerImg = (props) => {
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
naviagtion
.
reset
({
index
:
1
,
routes
:
[{
name
:
TABNAVIGATOR
}],
});
props
.
saveUserToRedux
(
res
.
data
.
data
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
...
...
@@ -103,7 +106,10 @@ const PickerImg = (props) => {
return
(
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
View
style
=
{
styles
.
containerImg
}
>
<
Image
source
=
{{
uri
:
imgAvatart
}}
style
=
{
styles
.
imgAvatar
}
/
>
<
Image
source
=
{{
uri
:
props
.
user
.
picture_url
}}
style
=
{
styles
.
imgAvatar
}
/
>
<
View
style
=
{
styles
.
iconPicker
}
>
<
Image
style
=
{{
width
:
20
,
height
:
20
}}
...
...
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