From 1170e7bcabd3bf2a0bb0fa273ec67dfbb828542c Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Sun, 7 Jul 2019 17:55:20 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=E6=97=A5=E8=AE=B0?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5ok=E7=BB=B7=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/DiaryDetailPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/page/DiaryDetailPage.js b/src/page/DiaryDetailPage.js index 1a0996e..edbcc40 100644 --- a/src/page/DiaryDetailPage.js +++ b/src/page/DiaryDetailPage.js @@ -30,7 +30,7 @@ function getTodayStr() { let month = now.getMonth() + 1; let date = now.getDate(); - return year + '-' + (month > 9 ? month : '0' + month) + '-' + date; + return year + '-' + (month > 9 ? month : '0' + month) + '-' + (date > 9 ? date : '0' + date); } export default class DiaryDetailPage extends Component { From f6e2b5d157b325a96202b46e70e7f05df9abf344 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Mon, 8 Jul 2019 16:20:00 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=20android=204.4?= =?UTF-8?q?=20=E9=A6=96=E9=A1=B5=E5=BA=95=E6=A0=8F=E4=B8=8D=E5=B1=95?= =?UTF-8?q?=E7=8E=B0=202.=20=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E5=90=8EA?= =?UTF-8?q?ctionSheet=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/HomePage.js | 5 ++++- src/page/NotificationPage.js | 4 +++- src/page/SettingPage.js | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/page/HomePage.js b/src/page/HomePage.js index b8491f1..404b684 100644 --- a/src/page/HomePage.js +++ b/src/page/HomePage.js @@ -119,7 +119,10 @@ export default class HomePage extends Component { } }, bottomTabs: { - visible: true + visible: true, + + drawBehind: false, + animate: false } }); diff --git a/src/page/NotificationPage.js b/src/page/NotificationPage.js index cdf6f65..7cf9be6 100644 --- a/src/page/NotificationPage.js +++ b/src/page/NotificationPage.js @@ -147,7 +147,9 @@ export default class NotificationPage extends Component { } refresh() { - this.list.refresh(false); + if(this.list) { + this.list.refresh(false); + } } _onDeletePress(msg) { diff --git a/src/page/SettingPage.js b/src/page/SettingPage.js index 6f6b47b..2a7adf4 100644 --- a/src/page/SettingPage.js +++ b/src/page/SettingPage.js @@ -114,6 +114,14 @@ export default class SettingPage extends Component { Alert.alert('提示','确认退出登录?',[ {text: '退出', style: 'destructive', onPress: () => { Api.logout(); + + /* + * clear ActionSheet instance + */ + if(global.__action_sheet) { + global.__action_sheet = null; + } + Navigation.setRoot({ root: { stack: { From 01991e929317e527b847fa8a600d69e40b3330d3 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Thu, 11 Jul 2019 20:49:46 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=20=E4=BB=8E?= =?UTF-8?q?=E6=97=A5=E8=AE=B0=E6=9C=AC=E5=88=97=E8=A1=A8=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=97=A5=E8=AE=B0=E5=B4=A9=E6=BA=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=20=E6=97=A5=E8=AE=B0=E4=BF=AE=E6=94=B9=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E6=97=A5=E8=AE=B0=E6=9C=AC=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/notebook/notebookDiaryList.js | 7 +++---- src/page/WritePage.js | 9 +++++++++ src/util/msg.js | 9 +++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/component/notebook/notebookDiaryList.js b/src/component/notebook/notebookDiaryList.js index 8e2b564..2a9e018 100644 --- a/src/component/notebook/notebookDiaryList.js +++ b/src/component/notebook/notebookDiaryList.js @@ -86,10 +86,10 @@ export default class NotebookDiaryList extends Component { } refreshOne(index, diary) { - console.log('index, diary:', index, diary); if(diary) { let list = this.state.rawlist; diary.user = list[index].user; + list[index] = diary; this.setState({ @@ -188,8 +188,7 @@ export default class NotebookDiaryList extends Component { diary: diary, showField: ['createdTime'], - expired: this.notebook.isExpired, - refreshBack: this.refreshOne.bind(this, index) + expired: this.notebook.isExpired } } }); @@ -215,7 +214,7 @@ export default class NotebookDiaryList extends Component { renderItem={(rowData) => { return ( - { + Msg.hideMsg(waitingToast); Msg.showMsg('日记保存完成'); DeviceEventEmitter.emit(Event.updateDiarys); @@ -271,6 +279,7 @@ export default class WritePage extends Component { } }) .catch(e => { + Msg.hideMsg(waitingToast); Msg.showMsg('保存失败'); }) .done(); diff --git a/src/util/msg.js b/src/util/msg.js index c6c4b49..846ab66 100644 --- a/src/util/msg.js +++ b/src/util/msg.js @@ -14,9 +14,14 @@ function showMsg(msg, option) { } } - Toast.show(msg, option); + return Toast.show(msg, option); +} + +function hideMsg(toast) { + Toast.hide(toast); } export default { - showMsg + showMsg, + hideMsg } \ No newline at end of file From 4cf622c40d8178b6868ada858d5bc84f330d62e7 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Thu, 11 Jul 2019 21:21:30 +0800 Subject: [PATCH 4/7] =?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 }); From 654fc227d11b61d8bb9015004484a62520a7764e Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Fri, 12 Jul 2019 23:53:31 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=20=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=BA=95=E6=A0=8F=E2=80=98=E9=A6=96=E9=A1=B5=E2=80=99?= =?UTF-8?q?=E5=92=8C=E2=80=98=E5=85=B3=E6=B3=A8=E2=80=99=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=8B=A5=E5=88=97=E8=A1=A8=E5=B7=B2=E7=BD=AE=E9=A1=B6=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E5=88=B7=E6=96=B0=E5=88=97=E8=A1=A8=202.=20=E6=97=A5?= =?UTF-8?q?=E8=AE=B0=E7=BC=96=E8=BE=91=E9=A1=B5=E7=9A=84=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A1=86=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/diary/diaryList.js | 13 ++++++++++++ src/page/FollowPage.js | 12 ++++++++++- src/page/WritePage.js | 36 ++++++++++++++++++++------------ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/src/component/diary/diaryList.js b/src/component/diary/diaryList.js index a73facc..5056830 100644 --- a/src/component/diary/diaryList.js +++ b/src/component/diary/diaryList.js @@ -53,6 +53,15 @@ export default class DiaryList extends Component { } scrollToTop() { + if(!this.scrollY) { + this.scrollY = 0; + } + + if(this.scrollY <= 10) { + this.refresh(); + return; + } + this.list.scrollToOffset({ offset: 0 }); @@ -263,6 +272,10 @@ export default class DiaryList extends Component { onEndReachedThreshold={2} onEndReached={this.state.hasMore ? this.loadMore.bind(this) : null} + + onScroll={(event) => { + this.scrollY = event.nativeEvent.contentOffset.y; + }} > diff --git a/src/page/FollowPage.js b/src/page/FollowPage.js index 3827505..494a98e 100644 --- a/src/page/FollowPage.js +++ b/src/page/FollowPage.js @@ -52,10 +52,20 @@ export default class FollowPage extends Component { }); } + componentDidMount() { + this.bottomTabEventListener = Navigation.events().registerBottomTabSelectedListener( + ({ selectedTabIndex, unselectedTabIndex }) => { + if(selectedTabIndex == unselectedTabIndex && selectedTabIndex == 1) { + this.diaryList.scrollToTop(); + } + } + ); + } + render() { return ( - this.list = r} + this.diaryList = r} dataSource={this.dataSource} {...this.props} diff --git a/src/page/WritePage.js b/src/page/WritePage.js index 4ca9d1c..cc7fa97 100644 --- a/src/page/WritePage.js +++ b/src/page/WritePage.js @@ -100,6 +100,7 @@ export default class WritePage extends Component { componentDidMount() { this.loadNotebook(); + this.contentInput.focus(); this.notebookListener = DeviceEventEmitter.addListener(Event.updateNotebooks, (param) => { this.loadNotebook(true); @@ -111,6 +112,7 @@ export default class WritePage extends Component { } openModal() { + this.contentInput.blur(); this.setState({modalVisible: true}); if(this.state.notebooks.length == 0) { @@ -120,15 +122,14 @@ export default class WritePage extends Component { } } - closeModal(showKeyboard = true) { - this.contentInput.blur(); + closeModal(showKeyboard = true, callback) { Animated.parallel([ Animated.timing( this.state.fadeAnimOpacity, { toValue: 0, duration: 350, - easing: Easing.out(Easing.cubic) + easing: Easing.out(Easing.linear) } ), Animated.timing( @@ -136,26 +137,35 @@ export default class WritePage extends Component { { toValue: 0, duration: 350, - easing: Easing.out(Easing.cubic) + easing: Easing.out(Easing.linear) } ) ]).start(({finished}) => { - this.setState({modalVisible: false}); if(!finished) { return; } - if(showKeyboard) { - setTimeout(() => this.contentInput.focus(), 100); - } + + this.setState({modalVisible: false}, () => { + setTimeout(() => { + if(showKeyboard) { + this.contentInput.focus() + } else { + if(typeof callback == 'function') { + callback(); + } + } + }, 100); + }); }); } _onCreateNotebook() { - this.closeModal(false); - Navigation.push(this.props.componentId, { - component: { - name: 'NotebookEdit' - } + this.closeModal(false, () => { + Navigation.push(this.props.componentId, { + component: { + name: 'NotebookEdit' + } + }); }); } From 2da961b2cc3974da830648ae73b8c537976f0f19 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Sat, 13 Jul 2019 19:12:37 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=A1=B5=E9=9D=A2=E9=94=9A=E5=9C=A8=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=202.=20=E6=97=A5=E8=AE=B0=E6=9C=AC=E6=97=A5=E8=AE=B0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=9B=BE=E7=89=87=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/notebook/notebookDiaryList.js | 12 ++++++++++++ src/page/UserPage.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/component/notebook/notebookDiaryList.js b/src/component/notebook/notebookDiaryList.js index 2a9e018..11fe531 100644 --- a/src/component/notebook/notebookDiaryList.js +++ b/src/component/notebook/notebookDiaryList.js @@ -194,6 +194,17 @@ export default class NotebookDiaryList extends Component { }); } + _onPhotoPress(photoUrl) { + Navigation.push(this.props.componentId, { + component: { + name: 'Photo', + passProps: { + url: photoUrl + } + } + }); + } + render() { if(!this.notebook) { return null; @@ -221,6 +232,7 @@ export default class NotebookDiaryList extends Component { isMine={isMine} onDiaryPress={this._onDiaryPress.bind(this, rowData.index)} + onPhotoPress={() => this._onPhotoPress(rowData.item.photoUrl)} refreshBack={this.refreshOne.bind(this, rowData.index)} > diff --git a/src/page/UserPage.js b/src/page/UserPage.js index 5802557..ac227d9 100644 --- a/src/page/UserPage.js +++ b/src/page/UserPage.js @@ -30,7 +30,7 @@ export default class UserPage extends Component { this.dataSource = new UserDiaryData(this.userId); this.state = { - index: 1, + index: this.user ? 0 : 1, routes: [ { key: 'userIntro', title: '简介' }, { key: 'diary', title: '日记' }, From b210fa92fd8d95f4c5ecce00719c3bbf2339bb83 Mon Sep 17 00:00:00 2001 From: xuwenyang Date: Sun, 14 Jul 2019 22:07:43 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug:=201.=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=EF=BC=8Cok=E7=BB=B7=E7=9A=84icon=E7=A7=BB=E5=88=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8F=B3=E4=BE=A7=202.=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=AF=84=E8=AE=BAicon=E7=9A=84=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/comment/comment.js | 2 +- src/component/diary/diaryBrief.js | 11 +++++++---- src/component/diary/diaryFull.js | 2 +- src/component/diary/diaryIconComment.js | 4 +++- src/component/diary/diaryIconOkB.js | 4 ++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/component/comment/comment.js b/src/component/comment/comment.js index 8e0a4e8..89ea4a1 100644 --- a/src/component/comment/comment.js +++ b/src/component/comment/comment.js @@ -114,7 +114,7 @@ const localStyle = StyleSheet.create({ moreIcon: { position: 'absolute', bottom: 0, - right: 10, + right: 15, paddingHorizontal: 12, paddingVertical: 5 } diff --git a/src/component/diary/diaryBrief.js b/src/component/diary/diaryBrief.js index 8d78cf1..67a1242 100644 --- a/src/component/diary/diaryBrief.js +++ b/src/component/diary/diaryBrief.js @@ -89,6 +89,8 @@ export default class DiaryBrief extends Component { + + - + { isMine && !expired ? @@ -134,7 +136,8 @@ const localStyle = StyleSheet.create({ title: { flexDirection: "row", alignItems: "flex-end", - paddingBottom: 5 + paddingBottom: 5, + paddingRight: 9 }, titleName: { fontWeight: 'bold', @@ -164,7 +167,7 @@ const localStyle = StyleSheet.create({ flexDirection: 'row' }, moreIcon: { - paddingVertical: 5, - paddingHorizontal: 5 + marginLeft: 7, + marginRight: 13 } }); diff --git a/src/component/diary/diaryFull.js b/src/component/diary/diaryFull.js index 8f963b0..936b379 100644 --- a/src/component/diary/diaryFull.js +++ b/src/component/diary/diaryFull.js @@ -157,7 +157,7 @@ const localStyle = StyleSheet.create({ title: { flexDirection: "row", alignItems: "flex-end", - paddingRight: 10, + paddingRight: 9, paddingBottom: 5 }, titleName: { diff --git a/src/component/diary/diaryIconComment.js b/src/component/diary/diaryIconComment.js index e6e02ef..eb8ddd1 100644 --- a/src/component/diary/diaryIconComment.js +++ b/src/component/diary/diaryIconComment.js @@ -29,9 +29,11 @@ export default class DiaryIconComment extends Component { const localStyle = StyleSheet.create({ wrap: { flexDirection: 'row', - marginRight: 6 + marginRight: 6, + marginTop: -1 }, icon: { + color: Color.inactiveText, marginLeft: 2, marginRight: 4 }, diff --git a/src/component/diary/diaryIconOkB.js b/src/component/diary/diaryIconOkB.js index 5856fc1..4fc3c8e 100644 --- a/src/component/diary/diaryIconOkB.js +++ b/src/component/diary/diaryIconOkB.js @@ -101,8 +101,8 @@ const localStyle = StyleSheet.create({ icon: { width: 18, height: 18, - marginLeft: 2, - marginRight: 4 + marginLeft: 4, + marginRight: 1 }, text: { fontSize: 15