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 });