mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(text-base): letter spacing for textfield (#8627)
closes https://github.com/NativeScript/NativeScript/pull/8626 closes https://github.com/NativeScript/NativeScript/issues/4892
This commit is contained in:
@ -6,6 +6,8 @@
|
|||||||
<TextField text="left" style="text-align: left" />
|
<TextField text="left" style="text-align: left" />
|
||||||
<TextField text="center" style="text-align: center" />
|
<TextField text="center" style="text-align: center" />
|
||||||
<TextField text="right" style="text-align: right" />
|
<TextField text="right" style="text-align: right" />
|
||||||
|
<!-- Text must not be predefined in the letter spacing test -->
|
||||||
|
<TextField style="letter-spacing: 0.9em;" />
|
||||||
|
|
||||||
<WrapLayout>
|
<WrapLayout>
|
||||||
<TextField text="normal" />
|
<TextField text="normal" />
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
|
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
|
||||||
"readme": "NativeScript Application",
|
"readme": "NativeScript Application",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"clean": "npx rimraf hooks node_modules platforms package-lock.json",
|
||||||
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
|
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
|
||||||
"e2e-debug": "./node_modules/.bin/ns-dev-appium --startSession",
|
"e2e-debug": "./node_modules/.bin/ns-dev-appium --startSession",
|
||||||
"e2e-watch": "tsc -p e2e --watch",
|
"e2e-watch": "tsc -p e2e --watch",
|
||||||
|
@ -288,6 +288,9 @@ export class TextBase extends TextBaseCommon {
|
|||||||
if (style.letterSpacing !== 0 && this.nativeTextViewProtected.font) {
|
if (style.letterSpacing !== 0 && this.nativeTextViewProtected.font) {
|
||||||
const kern = style.letterSpacing * this.nativeTextViewProtected.font.pointSize;
|
const kern = style.letterSpacing * this.nativeTextViewProtected.font.pointSize;
|
||||||
dict.set(NSKernAttributeName, kern);
|
dict.set(NSKernAttributeName, kern);
|
||||||
|
if (this.nativeTextViewProtected instanceof UITextField) {
|
||||||
|
this.nativeTextViewProtected.defaultTextAttributes.setValueForKey(kern, NSKernAttributeName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.color) {
|
if (style.color) {
|
||||||
|
Reference in New Issue
Block a user