mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(tabs): delay loadView when animation runs (#8353)
* fix(tabs): delay loadView when animation runs * chore: update api.md * chore: remove unnecessary casting * test: Added disabled test for changing tabs
This commit is contained in:
@@ -470,6 +470,12 @@ export abstract class ViewBase extends Observable {
|
||||
*/
|
||||
_setupAsRootView(context: any): void;
|
||||
|
||||
/**
|
||||
* When returning true the callLoaded method will be run in setTimeout
|
||||
* Method is intended to be overridden by inheritors and used as "protected"
|
||||
*/
|
||||
_shouldDelayLoad(): boolean;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
@@ -615,10 +615,18 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
|
||||
public loadView(view: ViewBase): void {
|
||||
if (view && !view.isLoaded) {
|
||||
view.callLoaded();
|
||||
if (this._shouldDelayLoad()) {
|
||||
setTimeout(() => view.callLoaded());
|
||||
} else {
|
||||
view.callLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public _shouldDelayLoad(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public unloadView(view: ViewBase): void {
|
||||
if (view && view.isLoaded) {
|
||||
view.callUnloaded();
|
||||
@@ -1053,7 +1061,7 @@ export const classNameProperty = new Property<ViewBase, string>({
|
||||
cssClasses.clear();
|
||||
|
||||
if (shouldAddModalRootViewCssClasses) {
|
||||
cssClasses.add(MODAL_ROOT_VIEW_CSS_CLASS);
|
||||
cssClasses.add(MODAL_ROOT_VIEW_CSS_CLASS);
|
||||
} else if (shouldAddRootViewCssClasses) {
|
||||
cssClasses.add(ROOT_VIEW_CSS_CLASS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user