score:4

Accepted answer

try to add a container to deal with the fixed position.

Something like this:


this.fixedHeader = {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

const FixedHeader = (children) => {
    return <div style={this.fixedHeader}>{children}</div>
}


render() {
    if (this.state.windowWidth < 1000) {
        return <FixedHeader>{ this.renderMobileHeader() }</FixedHeader>
    }
    return <FixedHeader>{ this.renderWideHeader() }</FixedHeader>
}


Related Query

More Query from same tag