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

Adjust the svg rate using jQuery or JavaScript

Seeking help with a gauge I found on CodePen - struggling to adjust bubble values... <path id="Fill-13" fill="#F8B50F" d="M3.7 88.532h26.535v-#.795H3.7z"/> Can change the bars in JS, but not the bubbles using jq/js. Adjust the gauge with values be ...

Issue with updating dropdown values in real-time in React

I am a beginner with React and I have a question regarding fetching dropdown values from the backend. Despite using async-await functions, the list is not getting populated with items. Any assistance in this matter would be greatly appreciated. Here is th ...

Ways to stylize bullet points in lists with CSS in HTML document

I am currently working on a Q&A page using simple HTML. This is the current appearance of my page. Check it out here on JSFIDDLE. My task involves adding an 'A' to the answer for each question. Some answers have multiple paragraphs, so the ...

The elements at the bottom of the Google homepage do not stay in place when hovering

I'm facing an issue and seeking guidance on how to make the footer and 'Google in different languages' fixed when hovering over the buttons. I'm attempting to create this on my own without referencing the Google homepage code in Chrome ...

What is the best way to create JavaScript code specifically for devices with a maximum width of 520px?

Is there a way to apply this JavaScript code specifically to devices with a maximum width of 520px? I could use some guidance on how to achieve this. // Apply code for max-width = 520px const myBtn = document.getElementById("darktheme"); const ...

Fixed navbar at the bottom of the page that transitions to static when scrolling reaches a certain location

Is it feasible to achieve this using Bootstrap v3? After conducting extensive research, it appears that a custom solution may be necessary. In essence, I am working with a navbar positioned at the bottom of the content area. Upon page load, if the navbar& ...

The background image shifts dynamically with a parallax effect as the page is scrolled

I need help solving a parallax issue that I'm currently facing. On my webpage, I have a background image positioned at the top with a parallax effect achieved through background-position: fixed. However, I now require the image to scroll along with t ...

I need to show a DIV element when a specific anchor is in an active state within an HTML document

Is there a way to make the code below only visible when the url ends with #404? <!--404 code--> <style> .div1 { width: 300px; height: 100px; border: 1px solid blue; border-color: #ff0263; box-sizing: border-box; } < ...

Is React 18 compatible with both react-redux and react-router?

At present, my react application is running on the following versions: react 17.0.x react-dom 17.0.x react-redux 7.2.x react-router-dom 5.x.x react-scripts 4.0.x redux 4.x.x My initial step towards upgrading to react@18 involved updating react-scripts to ...

What could possibly be causing this element to shift side to side (in IE only) during the CSS animation?

UPDATE: Issue occurring on Internet Explorer 10, Windows 7 When using the transform property to adjust the horizontal position of an element during animation, the vertical value is updated as well. However, despite setting the horizontal value to the same ...

Toggle the input box by clicking the button

How do I show or hide the input box (blue square) when I click the search button (red square)? Link Image I attempted to create the transition in CSS and also experimented with JavaScript, but the JavaScript part confused me. Here is what I tried: $(" ...

A transparent float is yielding unexpected outcomes

<!Doctype html> <html> <head> <meta charset="utf-8" /> <title>testing code</title> </head> <body> <div style="float: left; width: 200px; height: 150px; background-color: ...

Identify when I am using React Native on an Android device for permission detection

While using the AppState to reset the states of my App when it goes to the background, I encountered an issue with permissions requests such as Camera or Location triggering the AppState to change to "background" and reset all my states. Is there a way to ...

Tips on customizing the clear button icon functionality in Material UI Autocomplete?

Below is the code snippet I am currently working with: <Autocomplete id='combo-box-demo' options={companies} getOptionLabel={getOptionLabel} ...

Exploring the Contents of an ASP ListView

I am attempting to align the odd-numbered items to the left using float:left, and the even-numbered items to the right using float:right. However, it seems like every item is being considered as odd AND element 1 regardless of the actual order in the list. ...

Saving Style Sheets in a Database

Currently, I am interested in saving CSS data in a mySql database as part of my LAMP setup. My intention is to create an input field that includes the following code: body{ background: url("http://google.com/image.jpg") no-repeat; color: orange; } #someDi ...

Acquiring backend information to display in front-end using ReactJS

I receive data from the backend to present it in the following font: componentDidMount() { const response = this.props.store.privateImputationData; console.log(response); } When I check the console, it shows null. However, if I use a setTimeout, it w ...

I am facing an issue where the images (IMG) do not align properly when I test the responsiveness using Chrome

Seeking assistance with a design challenge I encountered. The first image showcases a well-structured table on desktop view, while the second image displays an undesired layout when examined using Chrome DevTools. A link to the problematic layout can be fo ...

Sending the query id in an API request resulted in an undefined id when trying to refresh the page

In my Next.js project, I am developing a blog application. My goal is to retrieve the value of a specific blog by passing an ID in the API request. const ViewDetail = () => { const[categoriesData,setCategoriesData]=useState([]); const router=useRou ...