From 4cf622c40d8178b6868ada858d5bc84f330d62e7 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Thu, 11 Jul 2019 21:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0=E4=B8=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/userIcon.js | 8 +++++++- src/page/WritePage.js | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/component/userIcon.js b/src/component/userIcon.js index 483bd70..feb6a69 100644 --- a/src/component/userIcon.js +++ b/src/component/userIcon.js @@ -8,7 +8,13 @@ export default class UserIcon extends Component { constructor(props) { super(props); this.state = { - iconUrl : props.iconUrl + iconUrl: props.iconUrl + }; + } + + static getDerivedStateFromProps(nextProps, prevState) { + return { + iconUrl: nextProps.iconUrl }; } diff --git a/src/page/WritePage.js b/src/page/WritePage.js index 6a4c4ba..4ca9d1c 100644 --- a/src/page/WritePage.js +++ b/src/page/WritePage.js @@ -241,12 +241,16 @@ export default class WritePage extends Component { } saveDiary() { + if(!this.state.content) { + return; + } + let photoUri = this.state.photoUri; let topic = this.props.topic ? 1 : 0; let waitingToast = Msg.showMsg('正在保存中', { duration: 10000, - position: -150, + position: -75, shadow: false, hideOnPress: false });