[FIX] Header title positioning not changing according to the number of icons (#2608)

This commit is contained in:
Diego Mello 2020-11-04 16:13:29 -03:00 committed by GitHub
parent 8bc32a3e77
commit 3a14e45470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -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({

View File

@ -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',

View File

@ -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 ? (

View File

@ -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: () => (