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

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.
@@ -155,7 +155,7 @@ public struct Title: View {
155
155
  let fontSize = fontScale(titleFontSize)
156
156
  // lineSpacing is added on top of the font's natural line height, not on top of fontSize.
157
157
  let lineSpacing = max(0, fontScale(titleLineHeight)
158
- - UIFont.systemFont(ofSize: fontSize, weight: uiFontWeight(titleFontWeight)).lineHeight)
158
+ - UIFont.systemFont(ofSize: fontSize).lineHeight)
159
159
 
160
160
  return SwiftUI.Text(title)
161
161
  .font(.system(size: fontSize, weight: titleFontWeight))
@@ -123,27 +123,13 @@ private func momoFont(size: CGFloat, weight: Font.Weight, family: String) -> Fon
123
123
  return .custom(name, fixedSize: size)
124
124
  }
125
125
 
126
- // UIFont twin of momoFont(); only used to read the real line height for lineSpacing.
127
- private func momoUIFont(size: CGFloat, weight: Font.Weight, family: String) -> UIFont {
128
- if let name = momoFontName(family: family, weight: weight),
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
129
  let font = UIFont(name: name, size: size) {
130
- return font
131
- }
132
- return .systemFont(ofSize: size, weight: uiFontWeight(weight))
133
- }
134
-
135
- func uiFontWeight(_ weight: Font.Weight) -> UIFont.Weight {
136
- switch weight {
137
- case .ultraLight: return .ultraLight
138
- case .thin: return .thin
139
- case .light: return .light
140
- case .medium: return .medium
141
- case .semibold: return .semibold
142
- case .bold: return .bold
143
- case .heavy: return .heavy
144
- case .black: return .black
145
- default: return .regular
130
+ return font.lineHeight
146
131
  }
132
+ return UIFont.systemFont(ofSize: size).lineHeight
147
133
  }
148
134
 
149
135
  public struct MomoText: View {
@@ -248,7 +234,7 @@ public struct MomoText: View {
248
234
  let fontSize = fontScale(typography.fontSize)
249
235
  // lineSpacing is added on top of the font's natural line height, not on top of fontSize.
250
236
  let lineSpacing = max(0, fontScale(typography.lineHeight)
251
- - momoUIFont(size: fontSize, weight: typography.fontWeight, family: theme.font).lineHeight)
237
+ - momoLineHeight(size: fontSize, family: theme.font))
252
238
 
253
239
  var text = baseText
254
240
  .font(momoFont(size: fontSize, weight: typography.fontWeight, family: theme.font))
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.17'
3
+ s.version = '0.167.1-beta.18'
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.17'
3
+ s.version = '0.167.1-beta.18'
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.17",
3
+ "version": "0.167.1-beta.18",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},