[FIX] Header title positioning not changing according to the number of icons (#2608)
This commit is contained in:
parent
8bc32a3e77
commit
3a14e45470
|
@ -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({
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 ? (
|
||||
|
|
|
@ -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: () => (
|
||||
|
|
Loading…
Reference in New Issue