Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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;
Expand All @@ -107,6 +107,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;
Expand Down
4 changes: 3 additions & 1 deletion packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -126,6 +126,8 @@ export const Utils = {
dispatchToMainThread,
queueMacrotask,
releaseNativeObject,
convertString,
escapeRegexSymbols,

getModuleName,
openFile,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
86 changes: 63 additions & 23 deletions packages/core/ui/bottom-navigation/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class BottomNavigation extends TabNavigationBase {
const fragmentToDetach = this._currentFragment;
if (fragmentToDetach) {
this.destroyItem((<any>fragmentToDetach).index, fragmentToDetach);
this.commitCurrentTransaction();
this.removeFragment(fragmentToDetach);
}
}

Expand All @@ -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) {}
}
}
}
}
}

Expand All @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 = (<any>fragment).getParentFragmentManager ? (<any>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<TabStripItem>) {
if (!this.tabStrip || !items) {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/ui/core/view/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-mobile-base/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
55 changes: 31 additions & 24 deletions packages/webpack/helpers/angular-config-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}
}
}
Expand All @@ -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 });
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 2 additions & 0 deletions tools/scripts/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down