mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(react): adding dynamic class to ion-page no longer hides component (#22666)
resolves #22631
This commit is contained in:
@ -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}
|
||||
|
Reference in New Issue
Block a user