[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; return 56;
}; };
export const getHeaderTitlePosition = insets => ({ export const getHeaderTitlePosition = ({ insets, numIconsRight }) => ({
left: 60 + insets.left, left: insets.left + 60,
right: 140 + insets.right right: insets.right + (45 * numIconsRight)
}); });
const styles = StyleSheet.create({ const styles = StyleSheet.create({

View File

@ -318,7 +318,7 @@ class RoomView extends React.Component {
if (!room?.rid) { if (!room?.rid) {
return; return;
} }
const headerTitlePosition = getHeaderTitlePosition(insets); const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 2 });
navigation.setOptions({ navigation.setOptions({
headerShown: true, headerShown: true,
headerTitleAlign: 'left', headerTitleAlign: 'left',

View File

@ -338,7 +338,7 @@ class RoomsListView extends React.Component {
getHeader = () => { getHeader = () => {
const { searching } = this.state; const { searching } = this.state;
const { navigation, isMasterDetail, insets } = this.props; const { navigation, isMasterDetail, insets } = this.props;
const headerTitlePosition = getHeaderTitlePosition(insets); const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 3 });
return { return {
headerTitleAlign: 'left', headerTitleAlign: 'left',
headerLeft: () => (searching ? ( headerLeft: () => (searching ? (

View File

@ -106,9 +106,9 @@ class ThreadMessagesView extends React.Component {
const { const {
navigation, isMasterDetail, insets, theme navigation, isMasterDetail, insets, theme
} = this.props; } = this.props;
const headerTitlePosition = getHeaderTitlePosition(insets);
if (isSearching) { if (isSearching) {
const headerTitlePosition = getHeaderTitlePosition({ insets, numIconsRight: 1 });
return { return {
headerTitleAlign: 'left', headerTitleAlign: 'left',
headerLeft: () => ( headerLeft: () => (