diff --git a/CHANGELOG.md b/CHANGELOG.md index f728acecd..78d1eb13a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,35 @@ +## [7.1.3](https://github.com/NativeScript/NativeScript/compare/7.1.2-core...7.1.3) (2021-01-17) + + +### Bug Fixes + +* **android:** BottomNavigation fragment child already has a parent ([#9148](https://github.com/NativeScript/NativeScript/issues/9148)) ([4690162](https://github.com/NativeScript/NativeScript/commit/4690162384c731d6d652d90a9347cae06c0a0e0c)) + + + +## [7.1.2](https://github.com/NativeScript/NativeScript/compare/7.1.1-core...7.1.2) (2021-01-14) + + +### Bug Fixes + +* **webpack:** support other workspace config styles ([7a79a89](https://github.com/NativeScript/NativeScript/commit/7a79a8988b55e7e0896e7ad38f571aba6987edb5)) + + +### Features + +* **core:** rollup additional Utils ([882aa42](https://github.com/NativeScript/NativeScript/commit/882aa42e8573615aa5ba89396d0f0cdbb711bed3)) + + + +## [7.1.1](https://github.com/NativeScript/NativeScript/compare/7.1.0-core...7.1.1) (2021-01-13) + + +### Bug Fixes + +* **core:** const initializer in an ambient context ([#9136](https://github.com/NativeScript/NativeScript/issues/9136)) ([47ebb1d](https://github.com/NativeScript/NativeScript/commit/47ebb1d262aa9ebf29fe445e57d19910612d047f)), closes [#9135](https://github.com/NativeScript/NativeScript/issues/9135) + + + # [7.1.0](https://github.com/NativeScript/NativeScript/compare/4.0.0-webpack...7.1.0) (2020-12-30) diff --git a/package.json b/package.json index 9c60d1d1a..7cc49b685 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.1.0", + "version": "7.1.3", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 13d43a714..6c8e4873b 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -95,7 +95,7 @@ export type { InstrumentationMode, TimerInfo } from './profiling'; export { encoding } from './text'; export * from './trace'; export * from './ui'; -import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source } from './utils'; +import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, escapeRegexSymbols, convertString } from './utils'; import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types'; export declare const Utils: { GC: typeof GC; @@ -109,6 +109,8 @@ export declare const Utils: { isMainThread: typeof isMainThread; dispatchToMainThread: typeof dispatchToMainThread; releaseNativeObject: typeof releaseNativeObject; + escapeRegexSymbols: typeof escapeRegexSymbols; + convertString: typeof convertString; getModuleName: typeof getModuleName; openFile: typeof openFile; openUrl: typeof openUrl; diff --git a/packages/core/index.ts b/packages/core/index.ts index 65879ead4..89f4e412f 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -110,7 +110,7 @@ export * from './trace'; export * from './ui'; -import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX } from './utils'; +import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX, escapeRegexSymbols, convertString } from './utils'; import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types'; export const Utils = { @@ -126,6 +126,8 @@ export const Utils = { dispatchToMainThread, queueMacrotask, releaseNativeObject, + convertString, + escapeRegexSymbols, getModuleName, openFile, diff --git a/packages/core/package.json b/packages/core/package.json index 9ee967ea9..d2ac0feaf 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.1.0", + "version": "7.1.3", "homepage": "https://nativescript.org", "repository": { "type": "git", diff --git a/packages/core/ui/bottom-navigation/index.android.ts b/packages/core/ui/bottom-navigation/index.android.ts index 6485a847d..e9ca17cc8 100644 --- a/packages/core/ui/bottom-navigation/index.android.ts +++ b/packages/core/ui/bottom-navigation/index.android.ts @@ -428,7 +428,7 @@ export class BottomNavigation extends TabNavigationBase { const fragmentToDetach = this._currentFragment; if (fragmentToDetach) { this.destroyItem((fragmentToDetach).index, fragmentToDetach); - this.commitCurrentTransaction(); + this.removeFragment(fragmentToDetach); } } @@ -454,28 +454,42 @@ export class BottomNavigation extends TabNavigationBase { private disposeTabFragments(): void { const fragmentManager = this._getFragmentManager(); - const transaction = fragmentManager.beginTransaction(); const fragments = fragmentManager.getFragments().toArray(); for (let i = 0; i < fragments.length; i++) { - transaction.remove(fragments[i]); + this.removeFragment(fragments[i]); } - - transaction.commitNowAllowingStateLoss(); } - private get currentTransaction(): androidx.fragment.app.FragmentTransaction { - if (!this._currentTransaction) { - const fragmentManager = this._getFragmentManager(); - this._currentTransaction = fragmentManager.beginTransaction(); - } - - return this._currentTransaction; - } - - private commitCurrentTransaction(): void { - if (this._currentTransaction) { - this._currentTransaction.commitNowAllowingStateLoss(); - this._currentTransaction = null; + private attachFragment(fragment: androidx.fragment.app.Fragment, id?: number, name?: string): void { + const fragmentManager = this._getFragmentManager(); + if (fragment) { + if (fragment.isAdded() || fragment.isRemoving()) { + // ignore + } else { + const fragmentExitTransition = fragment.getExitTransition(); + if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) { + fragmentExitTransition.setResetOnTransitionEnd(true); + } + if (fragmentManager) { + if (!fragmentManager.isDestroyed()) { + try { + if (fragmentManager.isStateSaved()) { + if (id && name) { + fragmentManager.beginTransaction().add(id, fragment, name).commitNowAllowingStateLoss(); + } else { + fragmentManager.beginTransaction().attach(fragment).commitNowAllowingStateLoss(); + } + } else { + if (id && name) { + fragmentManager.beginTransaction().add(id, fragment, name).commitNow(); + } else { + fragmentManager.beginTransaction().attach(fragment).commitNow(); + } + } + } catch (e) {} + } + } + } } } @@ -495,8 +509,6 @@ export class BottomNavigation extends TabNavigationBase { const fragment = this.instantiateItem(this._contentView, index); this.setPrimaryItem(index, fragment); - - this.commitCurrentTransaction(); } private instantiateItem(container: android.view.ViewGroup, position: number): androidx.fragment.app.Fragment { @@ -505,10 +517,10 @@ export class BottomNavigation extends TabNavigationBase { const fragmentManager = this._getFragmentManager(); let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name); if (fragment != null) { - this.currentTransaction.attach(fragment); + this.attachFragment(fragment); } else { fragment = TabFragment.newInstance(this._domId, position); - this.currentTransaction.add(container.getId(), fragment, name); + this.attachFragment(fragment, container.getId(), name); } if (fragment !== this._currentFragment) { @@ -545,7 +557,7 @@ export class BottomNavigation extends TabNavigationBase { private destroyItem(position: number, fragment: androidx.fragment.app.Fragment): void { if (fragment) { - this.currentTransaction.detach(fragment); + this.removeFragment(fragment); if (this._currentFragment === fragment) { this._currentFragment = null; } @@ -555,6 +567,34 @@ export class BottomNavigation extends TabNavigationBase { this.items[position].canBeLoaded = false; } } + private removeFragment(fragment: androidx.fragment.app.Fragment, fragmentManager?: any) { + if (!fragmentManager) { + fragmentManager = this._getFragmentManager(); + } + if (fragment) { + if (!fragment.isAdded() || fragment.isRemoving()) { + // ignore + return; + } else { + const fragmentExitTransition = fragment.getExitTransition(); + if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) { + fragmentExitTransition.setResetOnTransitionEnd(true); + } + if (fragment && fragment.isAdded() && !fragment.isRemoving()) { + const pfm = (fragment).getParentFragmentManager ? (fragment).getParentFragmentManager() : null; + if (pfm && !pfm.isDestroyed()) { + try { + if (pfm.isStateSaved()) { + pfm.beginTransaction().remove(fragment).commitNowAllowingStateLoss(); + } else { + pfm.beginTransaction().remove(fragment).commitNow(); + } + } catch (e) {} + } + } + } + } + } private setTabStripItems(items: Array) { if (!this.tabStrip || !items) { diff --git a/packages/core/ui/core/view/index.d.ts b/packages/core/ui/core/view/index.d.ts index 4eeec3f88..696f9fbd3 100644 --- a/packages/core/ui/core/view/index.d.ts +++ b/packages/core/ui/core/view/index.d.ts @@ -392,6 +392,11 @@ export abstract class View extends ViewBase { * Enables or disables the iosOverflowSafeArea property for all children. This property is iOS specific. Default value: true */ iosOverflowSafeAreaEnabled: boolean; + + /** + * Gets or sets a value indicating whether the the view should totally ignore safe areas computation. This property is iOS specific. Default value: false + */ + iosIgnoreSafeArea: boolean; /** * Gets is layout is valid. This is a read-only property. diff --git a/packages/ui-mobile-base/package.json b/packages/ui-mobile-base/package.json index 89820b440..8b62c5224 100644 --- a/packages/ui-mobile-base/package.json +++ b/packages/ui-mobile-base/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/ui-mobile-base", - "version": "7.0.0-rc.0", + "version": "7.0.0", "description": "Native UI base components used with NativeScript.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/packages/webpack/helpers/angular-config-parser.js b/packages/webpack/helpers/angular-config-parser.js index b96be3a2a..95d4398f6 100644 --- a/packages/webpack/helpers/angular-config-parser.js +++ b/packages/webpack/helpers/angular-config-parser.js @@ -21,21 +21,26 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug) if (workspaceConfig && projectName) { const projectSettings = workspaceConfig.projects[projectName]; if (projectSettings) { - + var targetProp = 'architect'; + if (!projectSettings.architect) { + targetProp = 'targets'; // Nx + } // default project configurations for (const envConfig of envConfigs) { - if (projectSettings.architect.default && projectSettings.architect.default.configurations) { - const defaultConfigurations = projectSettings.architect.default.configurations; - if (defaultConfigurations && defaultConfigurations[envConfig]) { - if (defaultConfigurations[envConfig].fileReplacements) { - for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) { - if (debug) { - console.log('project fileReplacement:', fileReplace); - } - if (fileReplace.replace.indexOf('.ts') > -1) { - fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); - } else { - copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); + if (projectSettings[targetProp]) { + if (projectSettings[targetProp].default && projectSettings[targetProp].default.configurations) { + const defaultConfigurations = projectSettings[targetProp].default.configurations; + if (defaultConfigurations && defaultConfigurations[envConfig]) { + if (defaultConfigurations[envConfig].fileReplacements) { + for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) { + if (debug) { + console.log('project fileReplacement:', fileReplace); + } + if (fileReplace.replace.indexOf('.ts') > -1) { + fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); + } else { + copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); + } } } } @@ -44,17 +49,19 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug) } // platform specific configurations (always override top level project configurations) for (const envConfig of envConfigs) { - if (projectSettings.architect && projectSettings.architect[platform]) { - const platformConfig = projectSettings.architect[platform].configurations; - if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) { - for (const fileReplace of platformConfig[envConfig].fileReplacements) { - if (debug) { - console.log(`"${platform}" specific fileReplacement:`, fileReplace); - } - if (fileReplace.replace.indexOf('.ts') > -1) { - fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); - } else { - copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); + if (projectSettings[targetProp]) { + if (projectSettings[targetProp] && projectSettings[targetProp][platform]) { + const platformConfig = projectSettings[targetProp][platform].configurations; + if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) { + for (const fileReplace of platformConfig[envConfig].fileReplacements) { + if (debug) { + console.log(`"${platform}" specific fileReplacement:`, fileReplace); + } + if (fileReplace.replace.indexOf('.ts') > -1) { + fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); + } else { + copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); + } } } } diff --git a/packages/webpack/package.json b/packages/webpack/package.json index a36b8222c..52652eb40 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "4.0.0", + "version": "4.0.1", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org", diff --git a/tools/scripts/build-docs.sh b/tools/scripts/build-docs.sh index 164ae2d2f..ecf076590 100755 --- a/tools/scripts/build-docs.sh +++ b/tools/scripts/build-docs.sh @@ -16,6 +16,8 @@ npm_install() { MARKER_FILE="./node_modules/installed" if [ ! -f "$MARKER_FILE" ] ; then + # Fixes perm issue while installing + npm i -g npm@^6.13.6 npm install npm install @types/handlebars@4.0.33 touch "$MARKER_FILE"