diff --git a/packages/core/file-system/file-system-access.android.ts b/packages/core/file-system/file-system-access.android.ts index 57ea84bf25..f16824ea45 100644 --- a/packages/core/file-system/file-system-access.android.ts +++ b/packages/core/file-system/file-system-access.android.ts @@ -282,7 +282,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - getApplicationContext() + getApplicationContext(), ); } catch (ex) { reject(ex); @@ -305,7 +305,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -343,7 +343,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -391,7 +391,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -429,7 +429,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -466,7 +466,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -504,7 +504,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -550,7 +550,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -635,7 +635,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -685,7 +685,7 @@ export class FileSystemAccess implements IFileSystemAccess { reject(err); }, }), - null + null, ); } catch (ex) { reject(ex); @@ -986,7 +986,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1019,7 +1019,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1058,7 +1058,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1098,7 +1098,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1137,7 +1137,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1174,7 +1174,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1215,7 +1215,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1254,7 +1254,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1293,7 +1293,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } @@ -1332,7 +1332,7 @@ export class FileSystemAccess29 extends FileSystemAccess { onError(error) { reject(error); }, - }) + }), ); }); } diff --git a/packages/core/profiling/index.ts b/packages/core/profiling/index.ts index 3a7b940fd7..2e976f92c9 100644 --- a/packages/core/profiling/index.ts +++ b/packages/core/profiling/index.ts @@ -119,7 +119,7 @@ function timelineProfileFunctionFactory(fn: F, name: string, const end = time(); console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`); } - } + } : function () { const start = time(); try { @@ -128,7 +128,7 @@ function timelineProfileFunctionFactory(fn: F, name: string, const end = time(); console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`); } - }; + }; } const enum MemberType { diff --git a/packages/core/ui/action-bar/index.android.ts b/packages/core/ui/action-bar/index.android.ts index f9b16ff340..44a938efb0 100644 --- a/packages/core/ui/action-bar/index.android.ts +++ b/packages/core/ui/action-bar/index.android.ts @@ -273,7 +273,7 @@ export class ActionBar extends ActionBarBase { owner._raiseTap(); } }, - }) + }), ); } else { this.nativeViewProtected.setNavigationIcon(null); @@ -362,7 +362,7 @@ export class ActionBar extends ActionBarBase { owner._raiseTap(); } }, - }) + }), ); } diff --git a/packages/core/ui/styling/font-common.ts b/packages/core/ui/styling/font-common.ts index e47de83bc5..599ca93792 100644 --- a/packages/core/ui/styling/font-common.ts +++ b/packages/core/ui/styling/font-common.ts @@ -17,7 +17,14 @@ export abstract class Font implements FontDefinition { return this.fontWeight === FontWeight.SEMI_BOLD || this.fontWeight === FontWeight.BOLD || this.fontWeight === '700' || this.fontWeight === FontWeight.EXTRA_BOLD || this.fontWeight === FontWeight.BLACK; } - protected constructor(public readonly fontFamily: string, public readonly fontSize: number, fontStyle?: FontStyleType, fontWeight?: FontWeightType, fontScale?: number, public readonly fontVariationSettings?: Array) { + protected constructor( + public readonly fontFamily: string, + public readonly fontSize: number, + fontStyle?: FontStyleType, + fontWeight?: FontWeightType, + fontScale?: number, + public readonly fontVariationSettings?: Array, + ) { this.fontStyle = fontStyle ?? FontStyle.NORMAL; this.fontWeight = fontWeight ?? FontWeight.NORMAL; this.fontScale = fontScale ?? 1; diff --git a/packages/core/ui/transition/page-transition.android.ts b/packages/core/ui/transition/page-transition.android.ts index 110cc2cb9b..46574c8875 100644 --- a/packages/core/ui/transition/page-transition.android.ts +++ b/packages/core/ui/transition/page-transition.android.ts @@ -2,14 +2,14 @@ import type { View } from '../core/view'; import { ViewBase } from '../core/view-base'; import { BackstackEntry } from '../frame'; import { isNumber } from '../../utils/types'; -import { FadeTransition } from './fade-transition'; import { Transition } from '.'; -import { getPageStartDefaultsForType, getRectFromProps, SharedTransition, SharedTransitionAnimationType, SharedTransitionEventData } from './shared-transition'; +import { getRectFromProps, SharedTransition, SharedTransitionAnimationType, SharedTransitionEventData } from './shared-transition'; import { ImageSource } from '../../image-source'; import { ContentView } from '../content-view'; import { GridLayout } from '../layouts/grid-layout'; -import { ad } from '../../utils'; import { Screen } from '../../platform'; +import { ExpandedEntry } from '../frame/fragment.transitions.android'; +import { android as AndroidUtils } from '../../utils/native-helper'; // import { Image } from '../image'; @NativeClass @@ -175,12 +175,20 @@ export class PageTransition extends Transition { return animationSet; } - androidFragmentTransactionCallback(fragmentTransaction: androidx.fragment.app.FragmentTransaction, currentEntry: BackstackEntry, newEntry: BackstackEntry) { + androidFragmentTransactionCallback(fragmentTransaction: androidx.fragment.app.FragmentTransaction, currentEntry: ExpandedEntry, newEntry: BackstackEntry) { const fromPage = currentEntry.resolvedPage; const toPage = newEntry.resolvedPage; const newFragment: androidx.fragment.app.Fragment = newEntry.fragment; const state = SharedTransition.getState(this.id); - const pageEnd = state?.pageEnd; + if (!state) { + // when navigating transition is set on the currentEntry but never cleaned up + // which means that on a next navigation forward (without transition) and back + // we will go here with an empty state! + currentEntry.transition = null; + return; + } + + const pageEnd = state.pageEnd; //we can't look for presented right now as the toPage might not be loaded // and thus some views like ListView/Pager... might not have loaded their "children" @@ -281,10 +289,10 @@ function loadViewInBackground(view: View) { hiddenHost.content = hostView; hiddenHost.visibility = 'collapse'; hostView.addChild(view); - hiddenHost._setupAsRootView(ad.getApplicationContext()); + hiddenHost._setupAsRootView(AndroidUtils.getApplicationContext()); hiddenHost.callLoaded(); - ad.getCurrentActivity().addContentView(hiddenHost.android, new android.view.ViewGroup.LayoutParams(0, 0)); + AndroidUtils.getCurrentActivity().addContentView(hiddenHost.android, new android.view.ViewGroup.LayoutParams(0, 0)); return { hiddenHost, diff --git a/packages/core/utils/platform-check.ts b/packages/core/utils/platform-check.ts index 5b25c18d3f..5e6acaf726 100644 --- a/packages/core/utils/platform-check.ts +++ b/packages/core/utils/platform-check.ts @@ -18,7 +18,7 @@ export function platformCheck(parent?: string) { throw new Error(errorMsg); }, - } + }, ); } diff --git a/packages/webpack5/src/helpers/fileReplacements.ts b/packages/webpack5/src/helpers/fileReplacements.ts index ae7c96fa57..a918b351a5 100644 --- a/packages/webpack5/src/helpers/fileReplacements.ts +++ b/packages/webpack5/src/helpers/fileReplacements.ts @@ -12,7 +12,7 @@ interface IReplacementMap { * @internal */ export function getFileReplacementsFromEnv( - env: IWebpackEnv = _env + env: IWebpackEnv = _env, ): IReplacementMap { const fileReplacements: IReplacementMap = {}; @@ -50,7 +50,7 @@ export function getFileReplacementsFromEnv( export function applyFileReplacements( config, - fileReplacements: IReplacementMap = getFileReplacementsFromEnv() + fileReplacements: IReplacementMap = getFileReplacementsFromEnv(), ) { Object.entries(fileReplacements).forEach(([_replace, _with]) => { // in case we are replacing source files - we'll use aliases diff --git a/packages/webpack5/src/helpers/log.ts b/packages/webpack5/src/helpers/log.ts index 753027821d..f3eeff25e6 100644 --- a/packages/webpack5/src/helpers/log.ts +++ b/packages/webpack5/src/helpers/log.ts @@ -17,7 +17,7 @@ export function error(...data: any): Error { // we return the error - the caller can throw or ignore if (typeof data[0] === 'string') { return new Error( - '\n\n[@nativescript/webpack]\n---\n\n' + dedent(data[0]) + '\n\n---\n' + '\n\n[@nativescript/webpack]\n---\n\n' + dedent(data[0]) + '\n\n---\n', ); } diff --git a/packages/webpack5/src/helpers/virtualModules.ts b/packages/webpack5/src/helpers/virtualModules.ts index 88f6815829..80974219a3 100644 --- a/packages/webpack5/src/helpers/virtualModules.ts +++ b/packages/webpack5/src/helpers/virtualModules.ts @@ -14,12 +14,12 @@ import { getProjectFilePath } from './project'; export function addVirtualEntry( config: Config, name: string, - contents: string + contents: string, ): string { return addVirtualModule( config, `__@nativescript_webpack_virtual_entry_${name}__`, - contents + contents, ); } @@ -29,7 +29,7 @@ export function addVirtualEntry( export function addVirtualModule( config: Config, name: string, - contents: string + contents: string, ): string { const virtualEntryPath = join(getEntryDirPath(), `${name}`); @@ -51,7 +51,7 @@ export function addVirtualModule( // todo: we can remove this special handling once we no longer support v11 if (config.plugins.has('AngularCompilerPlugin')) { const compatEntryPath = getProjectFilePath( - join('node_modules', '.nativescript', `${name}`) + join('node_modules', '.nativescript', `${name}`), ); mkdirSync(dirname(compatEntryPath), { recursive: true }); writeFileSync(compatEntryPath, options[virtualEntryPath]); diff --git a/packages/webpack5/src/index.ts b/packages/webpack5/src/index.ts index 7b79120b3a..93b466fd4e 100644 --- a/packages/webpack5/src/index.ts +++ b/packages/webpack5/src/index.ts @@ -143,7 +143,7 @@ export function useConfig(config: keyof typeof defaultConfigs | false) { */ export function chainWebpack( chainFn: (config: Config, env: IWebpackEnv) => any, - options?: { order?: number } + options?: { order?: number }, ) { webpackChains.push({ order: options?.order || 0, @@ -160,8 +160,8 @@ export function chainWebpack( export function mergeWebpack( mergeFn: ( config: Partial, - env: IWebpackEnv - ) => any | Partial + env: IWebpackEnv, + ) => any | Partial, ) { webpackMerges.push(mergeFn); } @@ -217,7 +217,7 @@ export function resolveChainableConfig(): Config { * @param chainableConfig Optional chain config to use. */ export function resolveConfig( - chainableConfig = resolveChainableConfig() + chainableConfig = resolveChainableConfig(), ): webpack.Configuration { if (!hasInitialized) { throw error('resolveConfig() must be called after init()');