SplitLayout: Hiding left view by setting width to 0 and resetting it to pre

In Vaadin 8 I was able to use HorizontalSplitPanel and hide the left view by setting the splitPosition to 0 and then expanding it by setting it to the stored split position. I currently can’t do this with Vaadin Flow. I tried removing the right content and removing the split layout and adding the right content when hiding it and then adding it when expanding but since I’m using a tree grid on the left side the tree grid shows up collapsed. So, is there way where I can just set the splitPosition to 0 and then back to the previous split position. Below is the Vaadin 8 code that I was using to do this.

private void expandCollapseButtonClicked(){
		if (this.currentSplitPanelState==SplitPanelState.EXPANDED){
			this.splitPosition=this.horizSplitPanel.getSplitPosition();
			this.currentSplitPanelState=SplitPanelState.COLLAPSED;
			this.horizSplitPanel.setSplitPosition(0);
		}else{
			if (this.splitPosition>5){
				this.horizSplitPanel.setSplitPosition(this.splitPosition);				
			}else{
				this.horizSplitPanel.setSplitPosition(5);								
			}
			this.currentSplitPanelState=SplitPanelState.EXPANDED;
		}
	}