Skip to content

Commit 8038ff0

Browse files
committed
chore: refactor
1 parent 1e569bb commit 8038ff0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/text/index.android.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type ClickableSpan = new (owner: Span) => android.text.style.ClickableSpan;
1010
export function adjustMinMaxFontScale(value, view) {
1111
// Only for iOS
1212
}
13-
function formattedStringToNativeString(formattedString, parent?, parentView = formattedString.parent, density?) {
13+
function formattedStringToNativeString(formattedString, parent?, parentView = formattedString.parent, density?,scaleLineHeight?) {
1414
let maxFontSize = formattedString?.fontSize || parentView?.fontSize || 0;
1515
formattedString.spans.forEach((s) => {
1616
if (s.fontSize) {
@@ -31,7 +31,7 @@ function formattedStringToNativeString(formattedString, parent?, parentView = fo
3131
}
3232

3333
let FONT_SIZE_FACTOR;
34-
function spanToNativeString(span, parent: any, parentView: any, maxFontSize?, index = -1, density?) {
34+
function spanToNativeString(span, parent: any, parentView: any, maxFontSize?, index = -1, density = 1, scaleLineHeight = false) {
3535
let text = span.text;
3636
const html = span.html;
3737
if ((!text && !html) || (span.visibility && span.visibility !== 'visible')) {
@@ -231,13 +231,14 @@ export function createNativeAttributedString(
231231
parentView?: ViewBase,
232232
autoFontSizeEnabled = false,
233233
fontSizeRatio = 1, // used only on iOS,
234-
density? // used only on Android
234+
density = 1, // used only on Android,
235+
scaleLineHeight = false // used only on Android,
235236
) {
236237
if (!context) {
237238
init();
238239
}
239240
if (data instanceof FormattedString || data instanceof LightFormattedString || (data as ObjectSpans).spans) {
240-
const strData = formattedStringToNativeString(data, undefined, this, density);
241+
const strData = formattedStringToNativeString(data, undefined, this, density, scaleLineHeight);
241242
return com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parentView?.['fontFamily'] || null, strData, null);
242243
}
243244
const theData = data as AttributedStringData;

0 commit comments

Comments
 (0)