From 6d80f147ac16ab738b3c6f0eb7a8ec7fdb86301c Mon Sep 17 00:00:00 2001 From: Siddharth Padhi Date: Thu, 30 Apr 2020 23:41:34 +0530 Subject: [PATCH] [FIX] AttachmentView (Android)(Tablet) (#2047) * [fix]Tablet attachment View and Room Navigation * fix weird navigation and margin bottom Co-authored-by: Djorkaeff Alexandre Co-authored-by: Diego Mello --- app/index.js | 4 +-- app/views/RoomActionsView/index.js | 48 ++++++++++++++++-------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/index.js b/app/index.js index cbc099457..832729a62 100644 --- a/app/index.js +++ b/app/index.js @@ -514,7 +514,7 @@ class CustomModalStack extends React.Component { const pageSheetViews = ['AttachmentView']; const pageSheet = pageSheetViews.includes(getActiveRouteName(navigation.state)); - const androidProps = isAndroid && { + const androidProps = isAndroid && !pageSheet && { style: { marginBottom: 0 } }; @@ -524,7 +524,7 @@ class CustomModalStack extends React.Component { ); - if (isAndroid) { + if (isAndroid && !pageSheet) { content = ( {content} diff --git a/app/views/RoomActionsView/index.js b/app/views/RoomActionsView/index.js index 5e6a30f8e..08fa24aaa 100644 --- a/app/views/RoomActionsView/index.js +++ b/app/views/RoomActionsView/index.js @@ -87,35 +87,37 @@ class RoomActionsView extends React.Component { async componentDidMount() { this.mounted = true; const { room, member } = this.state; - if (!room.id) { - try { - const result = await RocketChat.getChannelInfo(room.rid); - if (result.success) { - this.setState({ room: { ...result.channel, rid: result.channel._id } }); + if (room.rid) { + if (!room.id) { + try { + const result = await RocketChat.getChannelInfo(room.rid); + if (result.success) { + this.setState({ room: { ...result.channel, rid: result.channel._id } }); + } + } catch (e) { + log(e); } - } catch (e) { - log(e); } - } - if (room && room.t !== 'd' && this.canViewMembers()) { - try { - const counters = await RocketChat.getRoomCounters(room.rid, room.t); - if (counters.success) { - this.setState({ membersCount: counters.members, joined: counters.joined }); + if (room && room.t !== 'd' && this.canViewMembers()) { + try { + const counters = await RocketChat.getRoomCounters(room.rid, room.t); + if (counters.success) { + this.setState({ membersCount: counters.members, joined: counters.joined }); + } + } catch (e) { + log(e); } - } catch (e) { - log(e); + } else if (room.t === 'd' && _.isEmpty(member)) { + this.updateRoomMember(); } - } else if (room.t === 'd' && _.isEmpty(member)) { - this.updateRoomMember(); + + const canAutoTranslate = await RocketChat.canAutoTranslate(); + this.setState({ canAutoTranslate }); + + this.canAddUser(); + this.canInviteUser(); } - - const canAutoTranslate = await RocketChat.canAutoTranslate(); - this.setState({ canAutoTranslate }); - - this.canAddUser(); - this.canInviteUser(); } componentWillUnmount() {