Master react (#19439)

chore(react): react rc3 release
This commit is contained in:
Ely Lucas
2019-09-24 11:52:12 -06:00
committed by GitHub
parent e90e960294
commit 61f04e50b1
15 changed files with 71 additions and 39 deletions

View File

@ -4,7 +4,7 @@ import { Location as HistoryLocation, UnregisterCallback } from 'history';
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { StackManager } from './StackManager';
import { generateUniqueId } from '../utils';
import { generateId } from '../utils';
import { LocationHistory } from '../utils/LocationHistory'
import { ViewItem } from './ViewItem';
import { ViewStack } from './ViewStacks';
@ -44,7 +44,7 @@ export class NavManager extends React.Component<NavManagerProps, NavManagerState
this.locationHistory.add({
hash: window.location.hash,
key: generateUniqueId(6),
key: generateId(),
pathname: window.location.pathname,
search: window.location.search,
state: {}

View File

@ -3,7 +3,7 @@ import { RouterDirection } from '@ionic/react';
import { Action as HistoryAction, Location as HistoryLocation, UnregisterCallback } from 'history';
import React from 'react';
import { BrowserRouter, BrowserRouterProps, matchPath, RouteComponentProps, withRouter } from 'react-router-dom';
import { generateUniqueId } from '../utils';
import { generateId } from '../utils';
import { IonRouteData } from './IonRouteData';
import { NavManager } from './NavManager';
import { RouteManagerContext, RouteManagerContextState } from './RouteManagerContext';
@ -49,7 +49,8 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
view.show = false;
view.ionPageElement = undefined;
view.isIonRoute = false;
view.key = generateUniqueId();
view.prevId = undefined;
view.key = generateId();
this.setState({
viewStacks
});
@ -76,10 +77,6 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
}
leavingView = viewStacks.findViewInfoById(this.activeIonPageId).view;
if (leavingView && leavingView.routeData.match!.url === location.pathname) {
return;
}
if (enteringView) {
if (enteringView.isIonRoute) {
@ -96,7 +93,7 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
* If the page is being pushed into the stack by another view,
* record the view that originally directed to the new view for back button purposes.
*/
enteringView.prevId = leavingView.id;
enteringView.prevId = enteringView.prevId || leavingView.id;
} else {
direction = direction || 'back';
leavingView.mount = false;
@ -159,8 +156,8 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
await this.registerViewStack(id, activeId, views, routerOutlet, this.props.location);
function createViewItem(child: React.ReactElement<any>, location: HistoryLocation) {
const viewId = generateUniqueId();
const key = generateUniqueId();
const viewId = generateId();
const key = generateId();
const route = child;
const matchProps = {
exact: child.props.exact,
@ -182,7 +179,7 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
};
if (!!match && view.isIonRoute) {
activeId = viewId;
};
}
return view;
}
}

View File

@ -1,5 +1,5 @@
import React from 'react';
import { generateUniqueId, isDevMode } from '../utils';
import { generateId, isDevMode } from '../utils';
import { View } from './View';
import { ViewTransitionManager } from './ViewTransitionManager';
import { RouteManagerContext } from './RouteManagerContext';
@ -18,7 +18,7 @@ export class StackManager extends React.Component<StackManagerProps, StackManage
constructor(props: StackManagerProps) {
super(props);
this.id = this.props.id || generateUniqueId();
this.id = this.props.id || generateId();
this.handleViewSync = this.handleViewSync.bind(this);
this.handleHideView = this.handleHideView.bind(this);
}