mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
committed by
Nathan Walker
parent
527c70b465
commit
726ef9fd8f
@@ -1,5 +1,5 @@
|
||||
import { Color } from '../../color';
|
||||
import { Length } from './style-properties';
|
||||
import { Length, zeroLength } from './style-properties';
|
||||
|
||||
export interface CSSShadow {
|
||||
inset: boolean;
|
||||
@@ -49,8 +49,11 @@ export function parseCSSShadow(value: string): CSSShadow {
|
||||
.filter((n) => n !== 'inset')
|
||||
.filter((n) => n !== colorRaw)
|
||||
.map((val) => {
|
||||
console.log(val);
|
||||
return Length.parse(val);
|
||||
try {
|
||||
return Length.parse(val);
|
||||
} catch (err) {
|
||||
return zeroLength;
|
||||
}
|
||||
});
|
||||
const [offsetX, offsetY, blurRadius, spreadRadius] = nums;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Color } from '../../color';
|
||||
import { FormattedString } from './formatted-string';
|
||||
import { Span } from './span';
|
||||
import { colorProperty, fontInternalProperty, Length, VerticalAlignment } from '../styling/style-properties';
|
||||
import { isString, isDefined, isNullOrUndefined } from '../../utils/types';
|
||||
import { isString, isNullOrUndefined } from '../../utils/types';
|
||||
import { iOSNativeHelper } from '../../utils';
|
||||
import { Trace } from '../../trace';
|
||||
|
||||
@@ -153,8 +153,7 @@ export class TextBase extends TextBaseCommon {
|
||||
if (!(value instanceof Font) || !this.formattedText) {
|
||||
let nativeView = this.nativeTextViewProtected;
|
||||
nativeView = nativeView instanceof UIButton ? nativeView.titleLabel : nativeView;
|
||||
const font = value instanceof Font ? value.getUIFont(nativeView.font) : value;
|
||||
nativeView.font = font;
|
||||
nativeView.font = value instanceof Font ? value.getUIFont(nativeView.font) : value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +189,7 @@ export class TextBase extends TextBaseCommon {
|
||||
this._setNativeText();
|
||||
}
|
||||
|
||||
[textShadowProperty.setNative](value: TextShadow) {
|
||||
[textShadowProperty.setNative](value: CSSShadow) {
|
||||
this._setShadow(value);
|
||||
}
|
||||
|
||||
@@ -378,7 +377,7 @@ export class TextBase extends TextBaseCommon {
|
||||
// layer.shadowOffset = CGSizeMake(Length.toDevicePixels(value.offsetX), Length.toDevicePixels(value.offsetY));
|
||||
layer.masksToBounds = false;
|
||||
|
||||
// NOTE: generally should not need shouldRaterize
|
||||
// NOTE: generally should not need shouldRasterize
|
||||
// however for various detailed animation work which involves text-shadow applicable layers, we may want to give users the control of enabling this with text-shadow
|
||||
// if (!(this.nativeTextViewProtected instanceof UITextView)) {
|
||||
// layer.shouldRasterize = true;
|
||||
|
||||
Reference in New Issue
Block a user