Topic: Full Page Intro with fixed Navbar - View class not showing up
                  
                  madahatter
                  free
                  asked 7 years ago
                
                Hello,
I am trying to use the Full Page Intro with fixed Navbar.  I have added it to my existing project and I believe I did all the correct steps.  The Navbar is showing but for some reason the <View> class is showing up behind the Navbar and the background image seems to be collapsed to no height.  Here are the steps I took to get to the point I am at now.
I added "mdbreact": "git+https://github.com/mdbootstrap/React-Bootstrap-with-Material-Design.git" in package.json
I ran npm install
I added this to my index.js file:
I have attached my code for you to review.
Did I forget a step or have I made an error.  Any help would be appreciated.  Thank you so much!
 
                
                  
                
                
                
                  
                  
                  
                    
                    
                
              
              
              
            import 'font-awesome/css/font-awesome.min.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'mdbreact/dist/css/mdb.css';
import 'bootstrap/dist/css/bootstrap.css'
import 'mdbreact/dist/css/mdb.css'
import React from 'react';
import { Navbar, NavbarBrand, NavbarNav, NavbarToggler, Collapse, NavItem, NavLink, Container, Mask, View} from 'mdbreact';
import { BrowserRouter as Router } from 'react-router-dom';
import 'font-awesome/css/font-awesome.min.css';
import 'bootstrap/dist/css/bootstrap.min.css'; 
import 'mdbreact/dist/css/mdb.css';
class NavbarNew extends React.Component {
  constructor(props) {
    super(props);
      this.state = {
        collapse: false,
        isWideEnough: false
      };
    this.onClick = this.onClick.bind(this);
  }
onClick(){
    this.setState({
      collapse: !this.state.collapse
  });
}
render() {
    return (
          <div>
            <header>
              <Router>
                <Navbar color="indigo" dark expand="md" scrolling>
                  <NavbarBrand href="/">
                      <strong>Navbar</strong>
                  </NavbarBrand>
                  { !this.state.isWideEnough && <NavbarToggler onClick = { this.onClick } />}
              <Collapse isOpen = { this.state.collapse } navbar>
                <NavbarNav left>
                  <NavItem active>
                      <NavLink to="/">Home</NavLink>
                  </NavItem>
                  <NavItem>
                      <NavLink to="/">Link</NavLink>
                  </NavItem>
                  <NavItem>
                      <NavLink to="/">Profile</NavLink>
                  </NavItem>
                </NavbarNav>
              </Collapse>
            </Navbar>
          </Router>
          <View src="https://mdbootstrap.com/img/Photos/Others/img%20(50).jpg">
            <Mask overlay="black-light" style={{flexDirection: 'column'}} className="flex-center  text-white text-center">
              <h2>This Navbar is fixed</h2>
              <h5>It will always stay visible on the top, even when you scroll down</h5>
              <br/>
              <p>Full page intro with background image will be always displayed in full screen mode, regardless of device </p>
            </Mask>
          </View>
        </header>
        <main>
          <Container className="text-center my-5">
            <p align="justify">Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
          </Container>
        </main>
      </div>
    );
  }
}
export default NavbarNew;
                      
                        Add comment
                      
                    
                  
                
                      
                      Anna Morawska
                      staff
                        answered 7 years ago
                    
                    Hi there,
View component is designed to inherit height from his parent. To solve your problem maybe try this:
                    
                      
                    
                    
                    
                    
                  
                  
                <div style={{height: '100vh'}}>
<View src="https://mdbootstrap.com/img/Photos/Others/img 20(50).jpg">
<Mask overlay="black-light" style={{flexDirection:'column'}} className="flex-center text-white text-center">
<h2>This Navbar is fixed</h2>
<h5>It will always stay visible on the top, even when you scroll down</h5>
<br/>
<p>Full page intro with background image will be always displayed in full screen mode, regardless of device </p>
</Mask>
</View>
</div>
Best,
Ania
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
              Answered
Specification of the issue
              - ForumUser: Free
 - Premium support: No
 - Technology: MDB React
 - MDB Version: 4.7.1
 - Device: PC
 - Browser: Chrome
 - OS: Windows
 - Provided sample code: No
 - Provided link: No