Skip to content

Commit 5b27793

Browse files
committed
fix(ios): span html support
1 parent d3b69ee commit 5b27793

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/text/index.ios.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ DTCoreTextFontDescriptor.asyncPreloadFontLookupTable();
1515
export function init() {}
1616

1717
function _createNativeAttributedString({
18-
text,
18+
autoFontSizeEnabled = false,
19+
color,
1920
familyName,
2021
fontSize,
22+
fontSizeRatio = 1,
2123
fontWeight,
2224
letterSpacing,
23-
lineHeight,
2425
lineBreak,
26+
lineHeight,
2527
linkColor,
2628
linkDecoration,
27-
color,
29+
text,
2830
textAlignment,
29-
autoFontSizeEnabled = false,
30-
fontSizeRatio = 1,
3131
useCustomLinkTag
3232
}: {
3333
text: string;
@@ -179,6 +179,10 @@ export function adjustMinMaxFontScale(value, view) {
179179
}
180180
export function createSpannableDetails(span: any, index, parentView: any, parent?: any, maxFontSize?, autoFontSizeEnabled = false, fontSizeRatio = 1) {
181181
let text = span.text;
182+
const html = span.html;
183+
if (html) {
184+
text = _createNativeAttributedString({ ...span, text: html, autoFontSizeEnabled, fontSizeRatio });
185+
}
182186
if (!text || (span.visibility && span.visibility !== 'visible')) {
183187
return null;
184188
}
@@ -241,13 +245,14 @@ export function createSpannableDetails(span: any, index, parentView: any, parent
241245
// in this case we dont want to set a font to use the drawing parent font
242246
// iosFont = Font.default.getUIFont(UIFont.systemFontOfSize(16));
243247
}
248+
244249
return {
245250
text,
246251
tapIndex: span._tappable ? index : undefined,
247252
autoFontSizeEnabled,
248253
iosFont,
249254
realFontSize,
250-
fontSize: fontSize/* || iosFont?.pointSize */, // testing for fontSize undefined to be defined by canvas
255+
fontSize /* || iosFont?.pointSize */, // testing for fontSize undefined to be defined by canvas
251256
realMaxFontSize,
252257
backgroundColor: backgroundcolor ? (backgroundcolor instanceof Color ? backgroundcolor.ios : new Color(backgroundcolor).ios) : null,
253258
color: textColor ? (textColor instanceof Color ? textColor.ios : new Color(textColor).ios) : null,

0 commit comments

Comments
 (0)