mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(react): first render performance improvements
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import { IonLifeCycleContext, NavContext } from '@ionic/react';
|
||||
import React from 'react';
|
||||
import { Redirect, Route } from 'react-router-dom';
|
||||
|
||||
import { isDevMode } from '../utils';
|
||||
|
||||
@ -20,20 +19,6 @@ export class View extends React.Component<ViewProps, {}> {
|
||||
context!: React.ContextType<typeof IonLifeCycleContext>;
|
||||
ionPage?: HTMLElement;
|
||||
|
||||
componentDidMount() {
|
||||
/**
|
||||
* If we can tell if view is a redirect, hide it so it will work again in future
|
||||
*/
|
||||
const { view, route } = this.props;
|
||||
if (route.type === Redirect) {
|
||||
this.props.onHideView(view.id);
|
||||
} else if (route.type === Route && route.props.render) {
|
||||
if (route.props.render().type === Redirect) {
|
||||
this.props.onHideView(view.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.ionPage) {
|
||||
this.ionPage.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler.bind(this));
|
||||
|
Reference in New Issue
Block a user