mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 18:17:31 +08:00
fix(react): first render performance improvements
This commit is contained in:
@ -4,11 +4,12 @@ import { Location as HistoryLocation, UnregisterCallback } from 'history';
|
||||
import React from 'react';
|
||||
import { RouteComponentProps } from 'react-router-dom';
|
||||
|
||||
import { IonRouteAction } from './IonRouteAction';
|
||||
import { StackManager } from './StackManager';
|
||||
|
||||
interface NavManagerProps extends RouteComponentProps {
|
||||
onNavigateBack: (defaultHref?: string) => void;
|
||||
onNavigate: (type: 'push' | 'replace', path: string, state?: any) => void;
|
||||
onNavigate: (type: 'push' | 'replace' | 'pop', path: string, state?: any) => void;
|
||||
}
|
||||
|
||||
export class NavManager extends React.Component<NavManagerProps, NavContextState> {
|
||||
@ -24,7 +25,7 @@ export class NavManager extends React.Component<NavManagerProps, NavContextState
|
||||
getStackManager: this.getStackManager.bind(this),
|
||||
getPageManager: this.getPageManager.bind(this),
|
||||
currentPath: this.props.location.pathname,
|
||||
registerIonPage: () => { return; }, // overridden in View for each IonPage
|
||||
registerIonPage: () => { return; } // overridden in View for each IonPage
|
||||
};
|
||||
|
||||
this.listenUnregisterCallback = this.props.history.listen((location: HistoryLocation) => {
|
||||
@ -52,8 +53,8 @@ export class NavManager extends React.Component<NavManagerProps, NavContextState
|
||||
this.props.onNavigateBack(defaultHref);
|
||||
}
|
||||
|
||||
navigate(path: string, direction?: RouterDirection | 'none', type: 'push' | 'replace' = 'push') {
|
||||
this.props.onNavigate(type, path, direction);
|
||||
navigate(path: string, direction?: RouterDirection | 'none', ionRouteAction: IonRouteAction = 'push') {
|
||||
this.props.onNavigate(ionRouteAction, path, direction);
|
||||
}
|
||||
|
||||
getPageManager() {
|
||||
|
Reference in New Issue
Block a user