ci: fix npm_install for core on CI (docs) (#9155)

* chore(release): @nativescript/core@7.1.1

* feat(core): rollup additional Utils

* fix(webpack): support other workspace config styles

* chore(release): @nativescript/core@7.1.2

* fix(android): BottomNavigation fragment child already has a parent (#9148)

closes https://github.com/NativeScript/NativeScript/issues/8132
closes https://github.com/NativeScript/NativeScript/issues/7901
closes https://github.com/NativeScript/NativeScript/issues/9051
closes https://github.com/NativeScript/NativeScript/issues/8251

* chore(release): @nativescript/core@7.1.3

* types: missing typings for iosIgnoreSafeArea (#9153)

* Update build-docs.sh

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>
Co-authored-by: Martin Guillon <martin.guillon@akylas.fr>
This commit is contained in:
Igor Randjelovic
2021-01-20 16:19:10 +01:00
committed by GitHub
parent ed52345167
commit 8a36e79c9b
11 changed files with 143 additions and 53 deletions

View File

@ -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)

View File

@ -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",

View File

@ -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;

View File

@ -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,

View File

@ -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",

View File

@ -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);
}
}
@ -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) {
private attachFragment(fragment: androidx.fragment.app.Fragment, id?: number, name?: string): void {
const fragmentManager = this._getFragmentManager();
this._currentTransaction = fragmentManager.beginTransaction();
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) {}
}
}
return this._currentTransaction;
}
private commitCurrentTransaction(): void {
if (this._currentTransaction) {
this._currentTransaction.commitNowAllowingStateLoss();
this._currentTransaction = null;
}
}
@ -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 = (<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) {

View File

@ -393,6 +393,11 @@ export abstract class View extends ViewBase {
*/
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.
*/

View File

@ -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"

View File

@ -21,11 +21,15 @@ 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 (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) {
@ -42,10 +46,12 @@ 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 (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) {
@ -63,6 +69,7 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug)
}
}
}
}
if (debug && copyReplacements.length) {
console.log('Adding to CopyWebpackPlugin:', copyReplacements);

View File

@ -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",

View File

@ -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"