From ab77145596eb894e59b4d57bbd9b68046a105ed2 Mon Sep 17 00:00:00 2001 From: mx1700 Date: Sun, 4 Aug 2019 21:22:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=99=E6=97=A5=E8=AE=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=80=80=E5=87=BA=E6=97=B6=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/WritePage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/page/WritePage.js b/src/page/WritePage.js index b7f1450..53c6f83 100644 --- a/src/page/WritePage.js +++ b/src/page/WritePage.js @@ -81,13 +81,13 @@ export default class WritePage extends Component { navigationButtonPressed({buttonId}) { if(buttonId == 'cancel') { - if(this.state.content.length > 0) { - Alert.alert('提示', '日记还没保存,退出将删除日记内容', [ + if(!(this.state.content.length === 0 || (this.diary && this.diary.content === this.state.content))) { + Alert.alert('提示', '你编辑的日记尚未保存,离开会使内容丢失', [ { text: '取消', onPress: () => {} }, { - text: '删除并退出', onPress: () => { + text: '确定离开', onPress: () => { this.closePage(); } }