Skip to content

iOS issue: Parallax image non responsive #91

@GBrachetta

Description

@GBrachetta

I want to achieve the following result in desktop view (two Material Ui Grids, the top one with the parallax on the left, the lower one on the right):

1desktop

and this on mobile view:

1mob

So the text renders under each parallax on smaller screens.

My current code for this is as follows:

import menno1 from '../assets/images/menno1.jpeg';
import { Parallax } from 'react-parallax';
import { makeStyles, Grid, Typography } from '@material-ui/core';
import { Fragment } from 'react';

const useStyles = makeStyles((theme) => ({
  flexGrid: {
    [theme.breakpoints.down('sm')]: {
      flexDirection: 'column-reverse',
    },
  },
}));

const Home = () => {
  const classes = useStyles();

  return (
    <Fragment>
      <Grid container>
        <Grid container item xs={12} md={12}>
          <Grid item xs={12} md={6}>
            <Parallax strength={400} bgImage={menno1}>
              <div style={{ height: 1000 }} />
            </Parallax>
          </Grid>
          <Grid container item xs={12} md={6}>
            <Typography variant="h4">
              Lorem ipsum dolor, sit amet consectetur adipisicing elit. Numquam
              exercitationem velit possimus labore atque rem, accusantium quae
              quidem repudiandae mollitia error magni, blanditiis quos eos
              consequatur nostrum illum cumque id!
            </Typography>
          </Grid>
        </Grid>

        <Grid container item xs={12} md={12} className={classes.flexGrid}>
          <Grid container item xs={12} md={6}>
            <Typography variant="h4">
              Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsum
              dolorem, esse voluptate quae libero non numquam nam maxime
              accusantium odit expedita explicabo doloribus architecto ea
              temporibus iste itaque ab veritatis.
            </Typography>
          </Grid>
          <Grid
            direction="column"
            container
            item
            xs={12}
            md={6}
            className={classes.item}
          >
            <Parallax strength={400} bgImage={menno1}>
              <div style={{ height: 1000 }} />
            </Parallax>
          </Grid>
        </Grid>
      </Grid>
    </Fragment>
  );
};

export default Home;

And this is working fine on chrome both on desktop and mobile views.

Here's the screenshot of the developer tools with the correct layout (all very schematic, just to have an MVP and style from there):

Screenshot 2021-03-02 at 23 22 35

But this is the result on my iPhone 12:

IMG_0315

Where am I failing here, or is this an iOS issue?

I have all that horizontal overflow and the Typography placement is all over the place.

I would really appreciate any help with this.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions