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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# [6.5.0](https://github.com/NativeScript/NativeScript/compare/6.4.2...6.5.0) (2020-03-18)


### Bug Fixes

* Fix issue for view not being removed from its parent ([#8432](https://github.com/NativeScript/NativeScript/issues/8432)) ([e081340](https://github.com/NativeScript/NativeScript/commit/e081340665605c54530587cc0cce9bc339585557))
* **d.ts:** Update iOS typings iOS 13.2 ([#8430](https://github.com/NativeScript/NativeScript/issues/8430)) ([18a9b1a](https://github.com/NativeScript/NativeScript/commit/18a9b1aea89ee9defee990ace7d2409327a47a28))
* **bottom-nav:** Android TabStripItems not aligned correctly when one of the image is smaller ([#8414](https://github.com/NativeScript/NativeScript/issues/8414))([9830be7](https://github.com/NativeScript/NativeScript/commit/9830be7230355638ace604145a3e3fad393c2a93))
* **tabs:** delay loadView when animation runs ([#8353](https://github.com/NativeScript/NativeScript/issues/8353)) ([e649a6c](https://github.com/NativeScript/NativeScript/commit/e649a6cfd618c86a1dc7fa84e3197dfb78c3bc74))


### Features

* **tabs:** Tabs styling improvements ([#8366](https://github.com/NativeScript/NativeScript/pull/8366))([4589431](https://github.com/NativeScript/NativeScript/commit/458943111e909fcdad47d12e7ee4bcd9732f4e90))
* **tabs:** Added selectedItemColor and unSelectedItemColor to the TabStrip ([#8435](https://github.com/NativeScript/NativeScript/issues/8435))([243dc98](https://github.com/NativeScript/NativeScript/commit/243dc98005d43617872da5cfc010e76178aa7f97))
* **gestures:** add locationX and locationY to double tap event data ([#8338](https://github.com/NativeScript/NativeScript/pull/8338))([5ff78e2](https://github.com/NativeScript/NativeScript/commit/5ff78e2ad2612259bff36d3aaf5a0292309f5a78))
* **tabs:** Added iconClass property to TabStripItem ([#8439](https://github.com/NativeScript/NativeScript/issues/8439))([270988d](https://github.com/NativeScript/NativeScript/commit/270988d26e1eeab97b4e5781451388e3a0a347e3))


## [6.4.2](https://github.com/NativeScript/NativeScript/compare/6.4.1...6.4.2) (2020-02-27)


Expand Down
2 changes: 2 additions & 0 deletions api-reports/NativeScript.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,8 @@ export abstract class ViewBase extends Observable {
public _goToVisualState(state: string): void;
public id: string;
// (undocumented)
public _ignoreFlexMinWidthHeightReset: boolean;
// (undocumented)
_inheritStyleScope(styleScope: any /* StyleScope */): void;
initNativeView(): void;
// (undocumented)
Expand Down
16 changes: 9 additions & 7 deletions nativescript-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
"ios": "6.0.0",
"android": "6.0.0"
},
"hooks": [{
"name": "nativescript-core",
"type": "before-checkForChanges",
"script": "cli-hooks/before-checkForChanges.js",
"inject": true
}]
"hooks": [
{
"name": "nativescript-core",
"type": "before-checkForChanges",
"script": "cli-hooks/before-checkForChanges.js",
"inject": true
}
]
},
"snapshot": {
"android": {
Expand All @@ -58,4 +60,4 @@
}
}
}
}
}
17 changes: 16 additions & 1 deletion nativescript-core/ui/button/button.android.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
ButtonBase, PseudoClassHandler,
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty,
Length, zIndexProperty, textAlignmentProperty, TextAlignment
Length, zIndexProperty, textAlignmentProperty, TextAlignment, layout,
minWidthProperty, minHeightProperty
} from "./button-common";
import { profile } from "../../profiling";
import { TouchGestureEventData, GestureTypes, TouchAction } from "../gestures";
Expand Down Expand Up @@ -111,6 +112,18 @@ export class Button extends ButtonBase {
}
}

[minWidthProperty.getDefault](): Length {
const dips = org.nativescript.widgets.ViewHelper.getMinWidth(this.nativeViewProtected);

return { value: dips, unit: "px" };
}

[minHeightProperty.getDefault](): Length {
const dips = org.nativescript.widgets.ViewHelper.getMinHeight(this.nativeViewProtected);

return { value: dips, unit: "px" };
}

[paddingTopProperty.getDefault](): Length {
return { value: this._defaultPaddingTop, unit: "px" };
}
Expand Down Expand Up @@ -177,3 +190,5 @@ export class Button extends ButtonBase {
return 4; // 4dp @dimen/button_pressed_z_material
}
}

Button.prototype._ignoreFlexMinWidthHeightReset = true;
7 changes: 7 additions & 0 deletions nativescript-core/ui/core/view-base/view-base.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,17 @@ export abstract class ViewBase extends Observable {
* @private
*/
public recycleNativeView: "always" | "never" | "auto";

/**
* @private
*/
public _isPaddingRelative: boolean;

/**
* @private
*/
public _ignoreFlexMinWidthHeightReset: boolean;

public _styleScope: any;

/**
Expand Down
1 change: 1 addition & 0 deletions nativescript-core/ui/core/view-base/view-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
_oldTop: number;
_oldRight: number;
_oldBottom: number;
_ignoreFlexMinWidthHeightReset: boolean;

public effectiveMinWidth: number;
public effectiveMinHeight: number;
Expand Down
21 changes: 10 additions & 11 deletions nativescript-core/ui/core/view/view.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export class View extends ViewCommon {
this.nativeViewProtected.setClickable(this._isClickable);
}
}

this._manager = null;
this._rootManager = null;
super.onUnloaded();
Expand Down Expand Up @@ -982,17 +982,17 @@ export class View extends ViewCommon {

[minWidthProperty.setNative](value: Length) {
if (this.parent instanceof CustomLayoutView && this.parent.nativeViewProtected) {
this.parent._setChildMinWidthNative(this);
this.parent._setChildMinWidthNative(this, value);
} else {
this._setMinWidthNative(this.minWidth);
this._setMinWidthNative(value);
}
}

[minHeightProperty.setNative](value: Length) {
if (this.parent instanceof CustomLayoutView && this.parent.nativeViewProtected) {
this.parent._setChildMinHeightNative(this);
this.parent._setChildMinHeightNative(this, value);
} else {
this._setMinHeightNative(this.minHeight);
this._setMinHeightNative(value);
}
}

Expand Down Expand Up @@ -1050,16 +1050,15 @@ export class CustomLayoutView extends ContainerView implements CustomLayoutViewD
}

public _updateNativeLayoutParams(child: View): void {
this._setChildMinWidthNative(child);
this._setChildMinHeightNative(child);
// noop
}

public _setChildMinWidthNative(child: View): void {
child._setMinWidthNative(child.minWidth);
public _setChildMinWidthNative(child: View, value: Length): void {
child._setMinWidthNative(value);
}

public _setChildMinHeightNative(child: View): void {
child._setMinHeightNative(child.minHeight);
public _setChildMinHeightNative(child: View, value: Length): void {
child._setMinHeightNative(value);
}

public _removeViewFromNativeVisualTree(child: ViewCommon): void {
Expand Down
4 changes: 2 additions & 2 deletions nativescript-core/ui/core/view/view.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,11 @@ export class CustomLayoutView extends ContainerView {
/**
* @private
*/
_setChildMinWidthNative(child: View): void;
_setChildMinWidthNative(child: View, value: Length): void;
/**
* @private
*/
_setChildMinHeightNative(child: View): void;
_setChildMinHeightNative(child: View, value: Length): void;
//@endprivate
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
flexShrinkProperty, FlexShrink,
flexWrapBeforeProperty, FlexWrapBefore,
alignSelfProperty, AlignSelf,
flexDirectionProperty, flexWrapProperty, justifyContentProperty, alignItemsProperty, alignContentProperty
flexDirectionProperty, flexWrapProperty, justifyContentProperty, alignItemsProperty, alignContentProperty,
minWidthProperty, minHeightProperty,
CssProperty
} from "./flexbox-layout-common";

export * from "./flexbox-layout-common";
Expand Down Expand Up @@ -137,6 +139,11 @@ export class FlexboxLayout extends FlexboxLayoutBase {
public _updateNativeLayoutParams(child: View): void {
super._updateNativeLayoutParams(child);

// NOTE: If minWidth/Height is not set, the next code will clear the default native values for minWidth/Height.
// Flex box will not respect the button default min width. Keeping this behavior for back-compatibility.
this._setChildMinWidthNative(child, child.minWidth);
this._setChildMinHeightNative(child, child.minHeight);

const lp = <org.nativescript.widgets.FlexboxLayout.LayoutParams>child.nativeViewProtected.getLayoutParams();
const style = child.style;
lp.order = style.order;
Expand All @@ -147,22 +154,30 @@ export class FlexboxLayout extends FlexboxLayoutBase {
child.nativeViewProtected.setLayoutParams(lp);
}

public _setChildMinWidthNative(child: View): void {
child._setMinWidthNative(0);
public _setChildMinWidthNative(child: View, value: Length): void {
// Check needed to maintain back-compat after https://github.com/NativeScript/NativeScript/pull/7804
if (!child._ignoreFlexMinWidthHeightReset) {
child._setMinWidthNative(0);
}

const nativeView = child.nativeViewProtected;
const lp = nativeView.getLayoutParams();
if (lp instanceof widgetLayoutParams) {
lp.minWidth = Length.toDevicePixels(child.style.minWidth, 0);
lp.minWidth = Length.toDevicePixels(value, 0);
nativeView.setLayoutParams(lp);
}
}

public _setChildMinHeightNative(child: View): void {
child._setMinHeightNative(0);
public _setChildMinHeightNative(child: View, value: Length): void {
// Check needed to maintain back-compat after https://github.com/NativeScript/NativeScript/pull/7804
if (!child._ignoreFlexMinWidthHeightReset) {
child._setMinHeightNative(0);
}

const nativeView = child.nativeViewProtected;
const lp = nativeView.getLayoutParams();
if (lp instanceof widgetLayoutParams) {
lp.minHeight = Length.toDevicePixels(child.style.minHeight, 0);
lp.minHeight = Length.toDevicePixels(value, 0);
nativeView.setLayoutParams(lp);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tns-core-modules-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
"android": "5.0.0"
}
}
}
}
Loading