Skip to content

Commit

Permalink
feat: fixed fontFamily (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakapon9517 committed Apr 26, 2024
1 parent 8690b58 commit 461c9d6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ios/RNUITextViewChildShadow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class RNUITextViewChildShadow: RCTShadowView {
@objc var fontSize: CGFloat = 16.0
@objc var fontStyle: String = "normal"
@objc var fontWeight: String = "normal"
@objc var fontFamily: String?
@objc var letterSpacing: CGFloat = 0.0
@objc var lineHeight: CGFloat = 0.0
@objc var pointerEvents: NSString?
Expand Down
1 change: 1 addition & 0 deletions ios/RNUITextViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ @interface RCT_EXTERN_MODULE(RNUITextViewChildManager, RCTViewManager)
RCT_REMAP_SHADOW_PROPERTY(fontSize, fontSize, CGFloat)
RCT_REMAP_SHADOW_PROPERTY(fontStyle, fontStyle, NSString)
RCT_REMAP_SHADOW_PROPERTY(fontWeight, fontWeight, NSString)
RCT_REMAP_SHADOW_PROPERTY(fontFamily, fontFamily, NSString)
RCT_REMAP_SHADOW_PROPERTY(letterSpacing, letterSpacing, CGFloat)
RCT_REMAP_SHADOW_PROPERTY(lineHeight, lineHeight, CGFloat)
RCT_REMAP_SHADOW_PROPERTY(pointerEvents, pointerEvents, NSString)
Expand Down
2 changes: 2 additions & 0 deletions ios/RNUITextViewShadow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ class RNUITextViewShadow: RCTShadowView {

if child.fontStyle == "italic" {
return font.italics()
} else if child.fontFamily != nil {
return UIFont(name: child.fontFamily!, size: scaledFontSize) ?? font
}

return font
Expand Down

0 comments on commit 461c9d6

Please sign in to comment.