[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;
|
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({
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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 ? (
|
||||||
|
|
|
@ -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: () => (
|
||||||
|
|
Loading…
Reference in New Issue