.flex-grow-1 in react-bootstrap does not expand to fill vertical space within <Row>

I'm having trouble using the .flex-grow-1 class in Bootstrap 4.6.0 (with react-bootstrap 1.5.2) to make a component within my layout expand and fill the remaining vertical space available.

"bootstrap": "^4.6",
"react-bootstrap": "1.5.2",

Below is the code that I have been working on to create a wireframe layout of the screen.

import React, { Component } from "react";
import { Col, Row } from "react-bootstrap";
import './SingleSignIn.scss'


class SignUpLayout extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  render() {
    const { country } = this.state;
    return (
      <Row>
        <Col id="left-column" className="grid bg-warning" style={{height: "100vw"}}>
          <Row className="grid flex-nowrap">
            <Col className="grid">
              {/* left margin */}
            </Col>
            <Col className="grid" xs={6} sm={6} md={6} lg={6} xl={6}>
              <Row className="grid" style={{height: "80px"}}>
                Welcome To:
              </Row>
              <Row className="grid" style={{height: "125px"}}>
                logo goes here
              </Row>
            </Col>
            <Col className="grid">
              {/* right margin */}
            </Col>
          </Row>
          <Row id="body" className="grid bg-danger flex-grow-1 flex-nowrap">
            <Col className="grid">
              {/* body left margin */}
            </Col>
            <Col className="grid" xs={10} sm={10} md={8} lg={8} xl={8}>
              <Row className="grid" style={{height: "10%"}}>
                e-mail input
              </Row>
              <Row className="grid" style={{height: "10%"}}>
                company name input
              </Row>
              <Row className="grid" style={{height: "10%"}}>
                country input
              </Row>
              <Row className="grid" style={{height: "10%"}}>
                phone number
              </Row>
              <Row className="grid" style={{height: "10%"}}>
                get started button
              </Row>
            </Col>
            <Col className="grid">
              {/* body right margin */}
            </Col>
          </Row>
        </Col>
        <Col id="right-column" className="grid" style={{height: "100vw"}}>
          Right Column
        </Col>
      </Row>
    )
  }
}

export default SignUpLayout;

My goal is to make the component labeled as #body expand vertically to fill the remaining available vertical space in the viewport. I have tried using the .flex-grow-1 class but it doesn't seem to be working as expected.

The wireframe layout that I currently have from the above code can be viewed here: https://i.sstatic.net/kbhSR.png

Any help or suggestions would be greatly appreciated.

Answer №1

I faced a similar issue but managed to find a resolution by utilizing bootstrap 5.3.2 in combination with react-bootstrap 2.9.0. Hopefully, this solution can assist others too. :)

/** @jsxImportSource @emotion/react */
import { css } from "@emotion/react";
import { Container, Row, Col } from "react-bootstrap";

function App() {
  return (
    <Container fluid={true} className="min-vh-100 d-flex flex-column">
      <Row>
        <Col
          sm={3}
      
          css={css`
            background-color: red;
          `}
        >A</Col>
        <Col
          sm={6}
          css={css`
            background-color: green;
          `}
        >
          B
        </Col>
        <Col
          sm={3}
          css={css`
            background-color: blue;
          `}
        >C</Col>
      </Row>

      <Row className="flex-grow-1">
        <Col
          sm={3}
          css={css`
            background-color: pink;
          `}
        ></Col>
        <Col
          sm={6}
          css={css`
            background-color: yellow;
          `}
        ></Col>
        <Col
          sm={3}
          css={css`
            background-color: purple;
          `}
        ></Col>
      </Row>
      <Row>
        <Col
          sm={12}
          css={css`
            background-color: grey;
          `}
        >Footer</Col>
      </Row>
    </Container>
  );
}

export default App;

Check out the final outcome HERE

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

Is there a way to overlay a div on a particular line within a p element?

Within this paragraph lies a collection of text encapsulated by a < p > tag. When this content is displayed on the page, it spans across 5 lines. My objective is to creatively style and position a < div > tag in order to highlight a specific li ...

Replacing Bootstrap CSS with a custom stylesheet

Within my bootstrap.css file, the following styling is defined: .form-control { display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.428571429; color: #555555; ve ...

How is it possible that I am able to retrieve an image from the public folder but unable to access a

I recently started learning Reactjs and came across this issue. In the images folder of my React project created with create-react-app, I have placed both a json file and a jpg image. However, I am able to use the jpg image but not the json file. let pho ...

Oops! There seems to be an issue with trying to access the 'map' property of undefined within the render method

While working on my project, I encountered an issue with a table from react material ui. The problem arises when attempting to populate the table with data from the state, resulting in an error message stating "cannot read property 'map' of undef ...

Implementing dynamic ID routes in React Router using JSON data

As a beginner in React, I have been working hard to improve my skills every day. However, I am currently facing a challenge with creating dynamic routes using JSON characters (specifically from Dragon Ball Z). Although my routes are set up correctly, I wo ...

Encountering a Typescript error while attempting to remove an event that has a FormEvent type

Struggling to remove an event listener in Typescript due to a mismatch between the expected type EventListenerOrEventListenerObject and the actual type of FormEvent: private saveHighScore (event: React.FormEvent<HTMLInputElement>) { This is how I t ...

Material-UI Masonry: Eliminate excess spacing on the right side

When utilizing Material-UI, I encountered an issue where the width of the Masonry Component does not completely fill the width of its parent container. The empty space left has a width exactly equal to the spacing between elements, which is understandable ...

Is there a way to customize the color of the collapsible menu?

I am currently delving into Bootstrap to enhance my skills. I decided to utilize the example navbar provided in the documentation: <nav class="navbar navbar-expand-lg navbar-light bg-primary"> <div class="container-fluid"&g ...

Issue with Date Time Picker functionality in Material UI on Safari browser

I recently implemented a Date Picker in my application. While it is functioning properly on Android Chrome browser, there seem to be some UI issues when using Safari. Can anyone help me troubleshoot this? <LocalizationProvider dateAdapter={AdapterM ...

Initiate a replicated create-react-app project directly from GitHub

After cloning a React application from GitHub to my local computer, I encountered an error while trying to run npm start: > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5725323634237a23222338176779667967">[email  ...

Struggling to locate the correct path for the CSS file in Express and Handlebars

As part of a student exercise, I am attempting to access an API containing information about presidents and style them using CSS. However, I am facing issues with linking the style.css file. I have tried various methods to change the path and public path ...

Transform the look of an inactive hyperlink

Can the visual style of an HTML link be modified when it is disabled? For instance, by implementing something like this: a.disabled { color:#050; } <a class="disabled" disabled="disabled" href="#">Testing</a> The code snippet above appears ...

The Safari 7.1+ browser seems to be having trouble with the spotlight effect

Why is the CodePen not functioning properly in Safari? Despite working well in Chrome and Firefox, it completely fails to work in Safari 7.1+. Can anyone provide some insights? http://codepen.io/cchambers/pen/Dyldj $(document).on("mousemove", function( ...

Having trouble with React's useEffect and React-Query's useQuery?

As a React newbie, I'm trying to implement global error handling using a context provider and a custom hook. Main Objective: Implementing a system to handle errors at the global level. The Issue: Errors reappear immediately after being removed. I s ...

Rowing and Columning with Bootstrap

Hey there! I'm currently working on creating some stylish boxes to showcase text and possibly an image background. However, I'm encountering an issue where the boxes are not aligning correctly on smaller screens. https://i.sstatic.net/JoYtj.jpg ...

Renewing tokens silently in React-oidc-context without the need for a page refresh

I have been attempting to implement silent token refreshes using the react-oidc-context library, which is based on oidc-client-ts. In my application, I utilize react-router. By default, silent token renewal is enabled with react-oid-context. However, this ...

Mastering the art of updating objects with React's useState() function

Having trouble updating my state using useState(). Whenever the alert pops up, it shows the initial value of my state. Below is a sample code snippet. I expect that when I click the Save button, setData should update data with the new form values, then di ...

Issue with Nginx setup - Unable to establish connection between three distinct servers (Client, API, Database)

What I am attempting to achieve I am currently working on setting up a connection between three individual servers (Client, API, and mySQL) by creating three VMs locally with the following IP addresses. Below is a simple testing React/Node code for each s ...

Why is my backend sending two Objects in the http response instead of just one?

When I receive data from my Django backend, sometimes instead of one object I get two objects within the HTTP response. This inconsistency is puzzling because it occurs intermittently - at times there's only one object, while other times there are two ...

What is the reason for labels appearing inside select boxes?

Can someone help me understand why my select box label is displaying inside the select box? For example, when I am not using react-material-validator it looks like this: https://codesandbox.io/s/5vr4xp8854 When I try to validate my select box using the r ...