From 3a14e454702ab10bbed480988a0d108ba55ee7d7 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 4 Nov 2020 16:13:29 -0300 Subject: [PATCH] [FIX] Header title positioning not changing according to the number of icons (#2608) --- app/containers/Header/index.js | 6 +++--- app/views/RoomView/index.js | 2 +- app/views/RoomsListView/index.js | 2 +- app/views/ThreadMessagesView/index.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/containers/Header/index.js b/app/containers/Header/index.js index efb98b65d..ca734c6ed 100644 --- a/app/containers/Header/index.js +++ b/app/containers/Header/index.js @@ -21,9 +21,9 @@ export const getHeaderHeight = (isLandscape) => { return 56; }; -export const getHeaderTitlePosition = insets => ({ - left: 60 + insets.left, - right: 140 + insets.right +export const getHeaderTitlePosition = ({ insets, numIconsRight }) => ({ + left: insets.left + 60, + right: insets.right + (45 * numIconsRight) }); const styles = StyleSheet.create({ diff --git a/app/views/RoomView/index.js b/app/views/RoomView/index.js index 7a7f7d9b9..db722e690 100644 --- a/app/views/RoomView/index.js +++ b/app/views/RoomView/index.js @@ -318,7 +318,7 @@ class RoomView extends React.Component { if (!room?.rid) { return; } - const headerTitlePosition = getHeaderTitlePosition(insets); + const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 2 }); navigation.setOptions({ headerShown: true, headerTitleAlign: 'left', diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index cfd88a8ed..8ed44e123 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -338,7 +338,7 @@ class RoomsListView extends React.Component { getHeader = () => { const { searching } = this.state; const { navigation, isMasterDetail, insets } = this.props; - const headerTitlePosition = getHeaderTitlePosition(insets); + const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 3 }); return { headerTitleAlign: 'left', headerLeft: () => (searching ? ( diff --git a/app/views/ThreadMessagesView/index.js b/app/views/ThreadMessagesView/index.js index 4d296a9a7..ba824605c 100644 --- a/app/views/ThreadMessagesView/index.js +++ b/app/views/ThreadMessagesView/index.js @@ -106,9 +106,9 @@ class ThreadMessagesView extends React.Component { const { navigation, isMasterDetail, insets, theme } = this.props; - const headerTitlePosition = getHeaderTitlePosition(insets); if (isSearching) { + const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 1 }); return { headerTitleAlign: 'left', headerLeft: () => (