fix(react): adding dynamic class to ion-page no longer hides component (#22666)

resolves #22631
This commit is contained in:
Ely Lucas
2020-12-15 09:02:06 -07:00
committed by GitHub
parent 09a5ed6a0d
commit a01bdb8c8d
5 changed files with 87 additions and 2 deletions

View File

@ -23,6 +23,9 @@ export class PageManager extends React.PureComponent<PageManagerProps> {
componentDidMount() {
if (this.ionPageElementRef.current) {
if (this.context.isInOutlet()) {
this.ionPageElementRef.current.classList.add('ion-page-invisible');
}
this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo!);
this.ionPageElementRef.current.addEventListener(
'ionViewWillEnter',
@ -87,11 +90,10 @@ export class PageManager extends React.PureComponent<PageManagerProps> {
<IonLifeCycleContext.Consumer>
{(context) => {
this.ionLifeCycleContext = context;
const hidePageClass = this.context.isInOutlet() ? 'ion-page-invisible' : '';
return (
<div
className={
className ? `${className} ion-page ${hidePageClass}` : `ion-page ${hidePageClass}`
className ? `${className} ion-page` : `ion-page`
}
ref={this.ionPageElementRef}
{...props}