mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Prevent app crash for css text-transform (#6815)
* Prevent app crash for css text-transform * refactor: formatting * refactor: formatting * minor refactoring * fix: use isString - text is sometimes String * fix: use isString - text is sometimes String
This commit is contained in:

committed by
Svetoslav

parent
cea97c6b45
commit
9f8d24a811
@ -7,6 +7,7 @@ import {
|
||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length,
|
||||
whiteSpaceProperty, lineHeightProperty, FormattedString, layout, Span, Color, isBold, resetSymbol
|
||||
} from "./text-base-common";
|
||||
import { isString } from "../../utils/types";
|
||||
|
||||
export * from "./text-base-common";
|
||||
|
||||
@ -323,6 +324,10 @@ function getCapitalizedString(str: string): string {
|
||||
}
|
||||
|
||||
export function getTransformedText(text: string, textTransform: TextTransform): string {
|
||||
if (!text || !isString(text)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
switch (textTransform) {
|
||||
case "uppercase":
|
||||
return text.toUpperCase();
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, lineHeightProperty,
|
||||
FormattedString, Span, Color, isBold, resetSymbol
|
||||
} from "./text-base-common";
|
||||
import { isString } from "../../utils/types";
|
||||
|
||||
export * from "./text-base-common";
|
||||
|
||||
@ -298,6 +299,10 @@ export class TextBase extends TextBaseCommon {
|
||||
}
|
||||
|
||||
export function getTransformedText(text: string, textTransform: TextTransform): string {
|
||||
if (!text || !isString(text)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
switch (textTransform) {
|
||||
case "uppercase":
|
||||
return NSStringFromNSAttributedString(text).uppercaseString;
|
||||
|
Reference in New Issue
Block a user