Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flex layout display problem with Safari IOS using fx-layout="column"

We are currently using Angular as a front-end with fx-layout api for responsiveness.

When we are using the fxLayout="column" all elements are collapsed and doesn't seem to have any height.

What are the best practice when using fx-layout/flex to handle these scenarios ?

Using angular 9.0.0rc with flex-layout": "^8.0.0-beta.27

Browserslist setting

0.5% last 2 versions Firefox ESR not dead # IE 9-11

Here an image from IOS Safari (12)

safari

Here an image from chrome

chrome

Here the repeated container which display the list seen in the image above

  <div *ngIf="!(dataSource.loading$ | async)">
<mat-card  class="pointer mb-2" *ngFor="let quotation of dataSource.quotations$ | async"
  (click)="onClickRow(quotation)">
  <mat-card-content fxLayout="row" fxLayoutGap.gt-xs="15px" fxLayout.xs="column" fxLayoutAlign="start center"
    fxLayoutAlign.xs="center center">

    <div fxLayout="column" fxLayoutAlign="center center">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasSalesRights && quotation.customer.photoUrl"
        [src]="quotation.customer.photoUrl" alt="">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasCustomerRights && quotation.salesRep.photoUrl"
        [src]="quotation.salesRep.photoUrl" alt="">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasSalesRights && !quotation.customer.photoUrl"
        src="https://storage.googleapis.com/edcommerce/businesslogic/images/placeholder/avatar.jpg" alt="">
    </div>

    <div fxLayout="column" fxFlex fxLayoutAlign.xs="center center">
      <div fxLayout="row" *ngIf="authSvc.currentUser.hasSalesRights">
        <span class="mat-body">{{quotation.createdDate | edDate}}</span>
      </div>
      <div fxLayout="row" fxLayoutAlign.xs="center center">
        <span class="mat-h2 m-0">{{quotUtils.getVehicleDescription(quotation)}}</span>
      </div>

      <div fxLayout="row" fxLayoutGap="10px" *ngIf="authSvc.currentUser.hasSalesRights"
        fxLayoutAlign="start center">
        <span class="mat-body">{{ts('common.user.text.roles.customer')}}</span>
        <span class="mat-body">{{quotation.customer.fullName}}</span>
      </div>

      <div fxLayout="row" fxLayoutGap="10px" *ngIf="authSvc.currentUser.hasBuyerRights"
        fxLayoutAlign="start center">
        <span class="mat-body">{{ts('common.user.text.roles.sales_rep')}}</span>
        <span class="mat-body">{{quotation.salesRep.fullName}}</span>

      </div>

      <div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="10px" fxLayoutAlign="start center">
        <span class="mat-body">{{ts('page.quotations.text.step_required')}}</span>
        <span
          class="mat-body-2 color-primary">{{enumUtils.Quotation.getStatusDescByRole(quotation.status,statusTypes)}}</span>
      </div>
    </div>

  </mat-card-content>
</mat-card>
  </div>
like image 720
Pilouk Avatar asked Jan 15 '20 20:01

Pilouk


1 Answers

The problem with safari occur on this element (second container in the mat-card-content):

<div fxLayout="column" fxFlex fxLayoutAlign.xs="center center">

The flex on safari resulted with a weird exponential number in the CSS something like this : flex: 1 1 1.12e-16

Changing fxFlex for fxFlex="grow" generated on safari this css flex : 1 1 100% which fix the height !

like image 68
Pilouk Avatar answered Oct 18 '22 04:10

Pilouk