What causes the entire page to disappear when the screen is adjusted to mobile width?

I'm facing an issue with my ReactJS screen. Everything works perfectly until I resize the screen to mobile width (sm of Material UI) and then everything turns into a WhiteScreen. I've been trying to debug this but can't seem to find the root cause. Any assistance would be highly appreciated.

import { Hidden, IconButton, Typography } from '@material-ui/core'
import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'

import useStyles from './styles/SubscribeNewRatePlans.styles'

return (
<div className={classes.root}>
  <div className={classes.header}>
    <Hidden mdUp>
      <IconButton className={classes.backButton} onClick={onBackClick}>
        <BackIcon />
      </IconButton>
    </Hidden>
    <Typography variant="h3" className={classes.title}>
      {getTranslate('Subscribe New Rate Plans')}
    </Typography>
  </div>
  <SubscribeNewRatePlansFilters
    acc={acc}
    setacc={setacc}
    dateObject={dateObject}
    setdateObject={setdateObject}
    inputValue={searchInputValue}
    setinputVal={setsearchInputValue}
  />
  {acc && dateObject.gregorianEndDate ? (
    <SubscribeNewRatePlansItemsBox
      rateplans={filteredRatePlans}
      loading={loading}
      accName={acc?.label || ''}
      selectedRatePlans={selectedRatePlans}
      setselectedRatePlans={setselectedRatePlans}
      ChannelId={params.id}
      EndDate={dateObject.gregorianEndDate || ''}
      StartDate={dateObject.gregorianStartDate || ''}
      onSubscribe={async () => {
        await channelSubscribe({
          variables: {
            input: selectedRatePlans
          }
        })
          .then(({ data: response }) => {
            toast.success(response.subscribeChannel.message)
          })
          .catch((err) => toast.error(err.message))
      }}
      selectAllRatePlans={selectAllRatePlans}
      setSelectAllRatePlans={setSelectAllRatePlans}
      rateMultiplier={rateMultiplier}
      setRateMultiplier={setRateMultiplier}
      showSubmitPaper={showSubmitPaper}
      setshowSubmitPaper={setshowSubmitPaper}
      acc={acc?.value || ''}
      propertyCode={acc?.code || ''}
    />
  ) : null}
</div>
)
}

This is my CSS:

import { makeStyles } from '@material-ui/core'

import { getDirection } from '../../../localization'

const useStyles = makeStyles((theme) => ({
  root: {},
  header: {
  display: 'flex',
  alignItems: 'center'
},
backButton: {
  padding: '8px 8px 4px 0',
  transform: `rotate(${getDirection() === 'rtl' ? '180deg' : '0deg'})`
},
filtersContainer: {
  display: 'flex',
  flexWrap: 'wrap',
  justifyContent: 'space-between'
},
halfSizeField: {
  width: '48%',
  [theme.breakpoints.down('sm')]: {
  width: '100%'
}
  },
    searchField: {
      width: '100%'
    },
    itemsBox: {
    paddingLeft: 16,
    paddingRight: 16,
    paddingBottom: 22,
    border: '1px solid #e7e7e7',
    borderRadius: 16,
    minHeight: 350,
    [theme.breakpoints.down('sm')]: {
      height: 'unset',
      paddingRight: 0
    }
  },
  listView: {},

  title: {
    marginBottom: 20,
    marginTop: 30,
    paddingBottom: 5,
    position: 'relative',
    width: 'fit-content'
  },
  submitFormBox: {
    position: 'fixed',
    bottom: 50,
    width: '60%',
    left: 'calc(20% + 57px)',
    borderRadius: 24,
    padding: 24,
    display: 'grid',
    gridTemplateColumns: '1fr',
    backgroundColor: theme.palette.background.default,
    [theme.breakpoints.down('sm')]: {
      width: '80%',
      left: 'calc(10% + 57px)'
    }
  }
}))

export default useStyles

Answer №1

This may not pinpoint the exact location of the issue, but it can help guide you in the right direction to investigate.

Given that you have identified the problem occurring specifically on mobile resizing, focus on elements impacted by this behavior. For instance,

halfSizeField: {
  width: '48%',
  [theme.breakpoints.down('sm')]: {    <---- confirm if this behaves as expected
  width: '100%'
}

and

minHeight: 350,
[theme.breakpoints.down('sm')]: {    <---- verify if this behaves as intended
  height: 'unset',
  paddingRight: 0
}

and

backgroundColor: theme.palette.background.default,
[theme.breakpoints.down('sm')]: {    <---- ensure this works correctly
  width: '80%',
  left: 'calc(10% + 57px)'
}

Some of these might not be working as you expect, so review them individually to identify any causing the issue.

If these snippets are not the root cause, look into other areas affected during resizing. This could involve inspecting JavaScript files, themes, or additional CSS files for potential culprits.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to relocate CSS Loader Container

Can someone help me with adjusting the placement of my container? I'm struggling to maintain the styles while getting rid of the position: absolute; on the .dot class. Every attempt I make is resulting in the dots moving erratically! To clarify, I w ...

How can I retrieve new values in MUI's Autocomplete with multiple selection and freesolo enabled?

I have developed an innovative autocomplete feature that allows users to select multiple items, either from a given list or by typing in a new value, similar to how email recipients are managed. All functions are working perfectly - adding items to the lis ...

Is the menu not appearing in the header section of the HTML/CSS?

Hey there, I'm a new student diving into the world of HTML/CSS. I've been working on creating a page layout, but for some reason my menu links are appearing under the header section instead of within it. I'm a bit confused and could really u ...

Understanding Express JS's handling of boolean values when reading them as strings

Using axios for communication between my React app and express API has presented an unexpected issue. Before sending the data, the value is identified as a boolean (as intended), but upon receival in the API, it gets converted to and stored as a string. T ...

When combining Symfony, Twig, and Semantic UI, users may encounter an issue where the background image fails to display

Can someone assist me in identifying the issue with my code? I am using Symfony 2.8, Semantic UI, and Twig, attempting to set a background image on my site. The modification is being made to my base.html.twig file. I have attempted: Using different ima ...

execute a different function once the animation has finished running with the .bind

When attempting to detect the completion of a CSS animation in order to remove a class, I encountered an issue where using .bind causes the animation end event to trigger even for the other function. You can view the complete code here. How can I ensure ...

The use of dangerouslySetInnerHTML causes the page layout to stretch, expand, or grow in size

I am currently working on my NextJs app, where I'm utilizing CosmicJs as a headless CMS to showcase content on the webpage. Within the layout of my page, I have structured it with 3 columns, and the content pulled from the CMS is meant to be displaye ...

Transferring css to an external file within an angular 4 component by utilizing webpack

I encountered this specific error message: Error: Anticipated 'styles' to be a collection of strings. Despite the fact that I have clearly defined the styles as an array of strings: styleUrls: ['./app.component.css'] Can anyone pinp ...

``I'm having trouble with TablePagination styling on a material-table component. Anyone have

I am trying to customize the appearance of rows numbered from-to of x on a Material-Table, using the following code: import MaterialTable from 'material-table' import { TablePagination, withStyles } from '@material-ui/core' const Style ...

Ways to decrease the height of accordion summary in Material-UI and React

I've been working on creating an accordion using the "@mui/material" library, but I'm encountering difficulties in fixing the height of AccordionSummary. I have tried various solutions listed below, but none of them seem to work for me: Setting ...

Changing the background color of an Expansion Panel when a Text Field input is focused

When I try to create an expansion panel with a text field inside the 'ExpansionPanelSummary', the color of the expansion panel background always turns into #E0E0E0 (grey[500]) when I focus on the text field input. Despite my efforts, I have foun ...

My custom CSS being overridden by Bootstrap styles

I'm currently working with Twitter Bootstrap's CSS, but it seems to be overriding some of my custom classes. Initially, I placed it before my own CSS in the HTML header (I am using jade and stylus template engines): doctype html html head ...

Vuetify's scrolling list feature allows for smooth navigation through a list

Check out my Vuetify code snippet that utilizes a list: <v-list> <v-list-tile v-for="user in users" :key="user.id" avatar @click="" > <v-list-tile-content> < ...

We're sorry, but the module you are looking for cannot be found. An error has occurred while trying

Struggling with an error while using React Material-UI to design my interface. The issue arises when using a specific component in the main layout. Seeking assistance from anyone who can help me find a solution. [287] ./src/components/RadioCustom.js 5.42 ...

What causes the text field and checkbox to move downward as I enter text?

I'm currently working on a mock login page using React and Material UI. I implemented a feature where the show/hide password icon only appears when the user starts typing in the password field. However, after making this change, I noticed that the pas ...

What steps can be taken to create a curved bottom for the header section?

While I've seen this question asked before, I'm not satisfied with how the design has been implemented. Here is my desired look for the curved header I've experimented with border radius left and right, but the edges are excessively rounde ...

Unraveling Complex JSON Structures in React

Having trouble reading nested JSON data from a places API URL call? Look no further! I've encountered issues trying to access all the information and nothing seems to be coming through in the console. While unnested JSON is not an issue, nested JSON p ...

Having trouble with the "initSdk" property being undefined in your React Native Appsflyer integration?

I'm currently facing an issue while trying to integrate AppsFlyer into a react native application. The error I am encountering is "Cannot read property 'initSdk' of undefined" Initially, I imported the react-native-appsflyer module as shown ...

A different approach for dynamically displaying React components sourced from an API

As I develop a website using Next.js/React that pulls in content from Strapi CMS, my goal is to create a dynamic page template for news articles. The aim is to empower content editors by giving them the flexibility to choose the type of content they wish t ...

Attempting to transition to react 18 leads to complications with package dependencies

I have just created a new project with create-react-app and my package.json file looks like this: { "name": "web", "version": "0.1.0", "private": true, "dependencies": { "@emotion/react": "^11.10.0", "@emotion/styled": "^11.10.0", "@fon ...