From 141635e9f032e1ab5d2c2200899f68079f9cfb90 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 29 May 2019 20:10:38 -0300 Subject: [PATCH] =?UTF-8?q?Adicionada=20foto=20padr=C3=A3o=20caso=20o=20us?= =?UTF-8?q?u=C3=A1rio=20n=C3=A3o=20escolha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Screens/PerfilSettings/perfilsettings.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Screens/PerfilSettings/perfilsettings.js b/src/Screens/PerfilSettings/perfilsettings.js index e8ce721..b64e6d6 100644 --- a/src/Screens/PerfilSettings/perfilsettings.js +++ b/src/Screens/PerfilSettings/perfilsettings.js @@ -32,8 +32,9 @@ export default class PerfilSettings extends Component { img: placeHolder[0], userName: "", eMail: "", - profileImageUrl: "", - disabled: true, + profileImageUrl: + "https://firebasestorage.googleapis.com/v0/b/unichat-35f13.appspot.com/o/profile-placeholder.png?alt=media&token=2cd02156-cb41-4142-8903-72abac4ddf3c", + disabled: false, uploading: false } this.user = firebase.auth().currentUser @@ -88,26 +89,20 @@ export default class PerfilSettings extends Component { uploadphotos = () => { const user = firebase.auth().currentUser const { img } = this.state - this.setState({ uploading: true }) + this.setState({ uploading: true, disabled: true }) firebase .storage() .ref(`profile_pics/${user.uid}`) .putFile(img.path) .on(firebase.storage.TaskEvent.STATE_CHANGED, snapshot => { - let state = {} - state = { - ...state - } if (snapshot.state === firebase.storage.TaskState.SUCCESS) { - state = { + this.setState({ disabled: false, uploading: false, profileImageUrl: snapshot.downloadURL - } + }) } - - this.setState(state) }) }