mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 11:17:04 +08:00
fix(core): inheritable property changes backstack propagation (#10438)
[skip ci]
This commit is contained in:

committed by
GitHub

parent
23127254ec
commit
48b1856d6c
@ -845,6 +845,12 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public _inheritStyles(view: ViewBase): void {
|
||||||
|
propagateInheritableProperties(this, view);
|
||||||
|
view._inheritStyleScope(this._styleScope);
|
||||||
|
propagateInheritableCssProperties(this.style, view.style);
|
||||||
|
}
|
||||||
|
|
||||||
@profile
|
@profile
|
||||||
public _addView(view: ViewBase, atIndex?: number) {
|
public _addView(view: ViewBase, atIndex?: number) {
|
||||||
if (Trace.isEnabled()) {
|
if (Trace.isEnabled()) {
|
||||||
@ -874,9 +880,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
|||||||
* Method is intended to be overridden by inheritors and used as "protected"
|
* Method is intended to be overridden by inheritors and used as "protected"
|
||||||
*/
|
*/
|
||||||
public _addViewCore(view: ViewBase, atIndex?: number) {
|
public _addViewCore(view: ViewBase, atIndex?: number) {
|
||||||
propagateInheritableProperties(this, view);
|
this._inheritStyles(view);
|
||||||
view._inheritStyleScope(this._styleScope);
|
|
||||||
propagateInheritableCssProperties(this.style, view.style);
|
|
||||||
|
|
||||||
if (this._context) {
|
if (this._context) {
|
||||||
view._setupUI(this._context, atIndex);
|
view._setupUI(this._context, atIndex);
|
||||||
|
@ -243,6 +243,7 @@ export class FrameBase extends CustomLayoutView {
|
|||||||
|
|
||||||
public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
|
public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
|
||||||
const newPage = entry.resolvedPage;
|
const newPage = entry.resolvedPage;
|
||||||
|
|
||||||
// In case we navigated forward to a page that was in the backstack
|
// In case we navigated forward to a page that was in the backstack
|
||||||
// with clearHistory: true
|
// with clearHistory: true
|
||||||
if (!newPage.frame) {
|
if (!newPage.frame) {
|
||||||
|
@ -916,6 +916,8 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
|||||||
frame._resolvedPage = page;
|
frame._resolvedPage = page;
|
||||||
|
|
||||||
if (page.parent === frame) {
|
if (page.parent === frame) {
|
||||||
|
frame._inheritStyles(page);
|
||||||
|
|
||||||
// If we are navigating to a page that was destroyed
|
// If we are navigating to a page that was destroyed
|
||||||
// reinitialize its UI.
|
// reinitialize its UI.
|
||||||
if (!page._context) {
|
if (!page._context) {
|
||||||
@ -927,12 +929,16 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
|
|||||||
page.callLoaded();
|
page.callLoaded();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!frame._styleScope) {
|
if (!page.parent) {
|
||||||
// Make sure page will have styleScope even if parents don't.
|
if (!frame._styleScope) {
|
||||||
page._updateStyleScope();
|
// Make sure page will have styleScope even if parents don't.
|
||||||
}
|
page._updateStyleScope();
|
||||||
|
}
|
||||||
|
|
||||||
frame._addView(page);
|
frame._addView(page);
|
||||||
|
} else {
|
||||||
|
throw new Error('Page is already shown on another frame.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const savedState = entry.viewSavedState;
|
const savedState = entry.viewSavedState;
|
||||||
|
@ -133,15 +133,19 @@ class UIViewControllerImpl extends UIViewController {
|
|||||||
if (frame) {
|
if (frame) {
|
||||||
frame._resolvedPage = owner;
|
frame._resolvedPage = owner;
|
||||||
|
|
||||||
if (!owner.parent) {
|
if (owner.parent === frame) {
|
||||||
if (!frame._styleScope) {
|
frame._inheritStyles(owner);
|
||||||
// Make sure page will have styleScope even if frame don't.
|
} else {
|
||||||
owner._updateStyleScope();
|
if (!owner.parent) {
|
||||||
}
|
if (!frame._styleScope) {
|
||||||
|
// Make sure page will have styleScope even if frame don't.
|
||||||
|
owner._updateStyleScope();
|
||||||
|
}
|
||||||
|
|
||||||
frame._addView(owner);
|
frame._addView(owner);
|
||||||
} else if (owner.parent !== frame) {
|
} else {
|
||||||
throw new Error('Page is already shown on another frame.');
|
throw new Error('Page is already shown on another frame.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame._updateActionBar(owner);
|
frame._updateActionBar(owner);
|
||||||
|
Reference in New Issue
Block a user