@momo-kits/native-kits 0.167.1-beta.18 → 0.167.1-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,16 +152,11 @@ public struct Title: View {
152
152
  }
153
153
 
154
154
  private var titleText: some View {
155
- let fontSize = fontScale(titleFontSize)
156
- // lineSpacing is added on top of the font's natural line height, not on top of fontSize.
157
- let lineSpacing = max(0, fontScale(titleLineHeight)
158
- - UIFont.systemFont(ofSize: fontSize).lineHeight)
159
-
160
- return SwiftUI.Text(title)
161
- .font(.system(size: fontSize, weight: titleFontWeight))
155
+ SwiftUI.Text(title)
156
+ .font(.system(size: fontScale(titleFontSize), weight: titleFontWeight))
162
157
  .ignoreBoldTextSetting()
163
158
  .foregroundColor(theme.colors.text.default)
164
- .lineSpacing(lineSpacing)
159
+ .lineSpacing(fontScale(titleLineHeight) - fontScale(titleFontSize))
165
160
  .lineLimit(titleMaxLines)
166
161
  .truncationMode(.tail)
167
162
  }
@@ -123,15 +123,6 @@ private func momoFont(size: CGFloat, weight: Font.Weight, family: String) -> Fon
123
123
  return .custom(name, fixedSize: size)
124
124
  }
125
125
 
126
- // lineHeight is identical across weights of a family, so the regular face is enough.
127
- private func momoLineHeight(size: CGFloat, family: String) -> CGFloat {
128
- if let name = momoFontName(family: family, weight: .regular),
129
- let font = UIFont(name: name, size: size) {
130
- return font.lineHeight
131
- }
132
- return UIFont.systemFont(ofSize: size).lineHeight
133
- }
134
-
135
126
  public struct MomoText: View {
136
127
  @Environment(\.appTheme) private var theme
137
128
  @Environment(\.momoFontScale) private var fontScale
@@ -231,13 +222,8 @@ public struct MomoText: View {
231
222
  // *Strikethrough styles) or the explicit `strikethrough` flag.
232
223
  let isStrikethrough = strikethrough || typography.isStrikethrough
233
224
 
234
- let fontSize = fontScale(typography.fontSize)
235
- // lineSpacing is added on top of the font's natural line height, not on top of fontSize.
236
- let lineSpacing = max(0, fontScale(typography.lineHeight)
237
- - momoLineHeight(size: fontSize, family: theme.font))
238
-
239
225
  var text = baseText
240
- .font(momoFont(size: fontSize, weight: typography.fontWeight, family: theme.font))
226
+ .font(momoFont(size: fontScale(typography.fontSize), weight: typography.fontWeight, family: theme.font))
241
227
  .foregroundColor(textColor)
242
228
  .strikethrough(isStrikethrough, color: textColor)
243
229
  .underline(underline, color: textColor)
@@ -248,7 +234,7 @@ public struct MomoText: View {
248
234
 
249
235
  return text
250
236
  .multilineTextAlignment(textAlign)
251
- .lineSpacing(lineSpacing)
237
+ .lineSpacing(fontScale(typography.lineHeight) - fontScale(typography.fontSize))
252
238
  .modifier(LineLimitModifier(range: lineLimitRange))
253
239
  .truncationMode(truncationMode)
254
240
  .fixedSize(horizontal: !softWrap, vertical: false)
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.18'
3
+ s.version = '0.167.1-beta.19'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.167.1-beta.18'
3
+ s.version = '0.167.1-beta.19'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.167.1-beta.18",
3
+ "version": "0.167.1-beta.19",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},