Skip to content

Commit

Permalink
fix: set the font size without considering the screen density
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyDaddy committed Jan 24, 2024
1 parent 8077617 commit da84135
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class TextStyle(val options: ReadableMap?) {
var shadowLayerStyle: ShadowLayerStyle?
var textBackgroundStyle: TextBackgroundStyle?
var underline: Boolean = if (options?.hasKey("underline") == true) options.getBoolean("underline") else false
var skewX: Float? = if (options?.hasKey("skewX") == true) options.getDouble("skewX")?.toFloat() else 0f
var skewX: Float? = if (options?.hasKey("skewX") == true) options.getDouble("skewX").toFloat() else 0f
var strikeThrough: Boolean = if (options?.hasKey("strikeThrough") == true) options.getBoolean("strikeThrough") else false
var textAlign: Align
var italic: Boolean = if (options?.hasKey("italic") == true) options.getBoolean("italic") else false
Expand Down
3 changes: 1 addition & 2 deletions ios/RCTImageMarker/TextStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class TextStyle: NSObject {
self.shadow = nil
}
self.textBackground = try TextBackground(textBackgroundStyle: (opts["textBackgroundStyle"] as? [AnyHashable : Any]))
let scale = UIScreen.main.scale
let fontSize = opts["fontSize"] != nil ? (RCTConvert.cgFloat(opts["fontSize"]) * scale) : (14.0 * scale)
let fontSize = opts["fontSize"] != nil ? RCTConvert.cgFloat(opts["fontSize"]) : 14.0
self.font = UIFont(name: opts["fontName"] as? String ?? "", size: fontSize)
if self.font == nil {
self.font = UIFont.systemFont(ofSize: fontSize)
Expand Down

0 comments on commit da84135

Please sign in to comment.