mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
committed by
Nathan Walker
parent
66d8afffc1
commit
aa1c631e6f
@@ -292,7 +292,8 @@ export class TextBase extends TextBaseCommon {
|
|||||||
case 'right':
|
case 'right':
|
||||||
this.nativeTextViewProtected.setGravity(android.view.Gravity.END | verticalGravity);
|
this.nativeTextViewProtected.setGravity(android.view.Gravity.END | verticalGravity);
|
||||||
break;
|
break;
|
||||||
default: // initial | left | justify
|
default:
|
||||||
|
// initial | left | justify
|
||||||
this.nativeTextViewProtected.setGravity(android.view.Gravity.START | verticalGravity);
|
this.nativeTextViewProtected.setGravity(android.view.Gravity.START | verticalGravity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -485,14 +486,9 @@ export class TextBase extends TextBaseCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getCapitalizedString(str: string): string {
|
function getCapitalizedString(str: string): string {
|
||||||
const words = str.split(' ');
|
let newString = str.toLowerCase();
|
||||||
const newWords = [];
|
newString = newString.replace(/(?:^|\s|[-"'([{])+\S/g, (c) => c.toUpperCase());
|
||||||
for (let i = 0, length = words.length; i < length; i++) {
|
return newString;
|
||||||
const word = words[i].toLowerCase();
|
|
||||||
newWords.push(word.substr(0, 1).toUpperCase() + word.substring(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
return newWords.join(' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTransformedText(text: string, textTransform: CoreTypes.TextTransformType): string {
|
export function getTransformedText(text: string, textTransform: CoreTypes.TextTransformType): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user