Merge pull request #3454 from NativeScript/z-index

Fix zIndex for Android buttons
This commit is contained in:
Rossen Hristov
2017-01-10 10:14:06 +02:00
committed by GitHub
2 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { import {
ButtonBase, TouchGestureEventData, GestureTypes, TouchAction, ButtonBase, TouchGestureEventData, GestureTypes, TouchAction,
PseudoClassHandler, PseudoClassHandler,
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty
} from "./button-common"; } from "./button-common";
export * from "./button-common"; export * from "./button-common";
@ -96,4 +96,15 @@ export class Button extends ButtonBase {
set [paddingLeftProperty.native](value: Length) { set [paddingLeftProperty.native](value: Length) {
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0)); org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
} }
get [zIndexProperty.native](): number {
return org.nativescript.widgets.ViewHelper.getZIndex(this.nativeView);
}
set [zIndexProperty.native](value: number) {
org.nativescript.widgets.ViewHelper.setZIndex(this.nativeView, value);
// API >= 21
if (this.nativeView.setStateListAnimator){
this.nativeView.setStateListAnimator(null);
}
}
} }

View File

@ -1914,7 +1914,7 @@ function isFloatValueConverter(value: string): number {
return newValue; return newValue;
} }
export const zIndexProperty = new CssProperty<Style, number>({ name: "zIndex", cssName: "z-index", defaultValue: 0, valueConverter: isFloatValueConverter }); export const zIndexProperty = new CssProperty<Style, number>({ name: "zIndex", cssName: "z-index", defaultValue: Number.NaN, valueConverter: isFloatValueConverter });
zIndexProperty.register(Style); zIndexProperty.register(Style);
function opacityConverter(value: any): number { function opacityConverter(value: any): number {