From 403af1a149dd632b8d97c463267438cf9e866391 Mon Sep 17 00:00:00 2001 From: xiezheng-XD <141627292+xiezheng-XD@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:53:00 +0800 Subject: [PATCH 1/2] docs(vue): typo in vue's README.md (#3444) --- driver/js/packages/hippy-vue-native-components/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/js/packages/hippy-vue-native-components/README.md b/driver/js/packages/hippy-vue-native-components/README.md index 623db39852a..9ed28279d0b 100644 --- a/driver/js/packages/hippy-vue-native-components/README.md +++ b/driver/js/packages/hippy-vue-native-components/README.md @@ -1,6 +1,6 @@ # Hippy Vue Native Components -> The package contains the **Native only** components provide by Hippy. +> The package contains the **Native only** components provided by Hippy. > For web alternative could use `hippy-vue-web-components`(it's not exist yet). ![Hippy Group](https://img.shields.io/badge/group-Hippy-blue.svg) From b6697c53d99a7e91304371ee13203e1ff2969e2b Mon Sep 17 00:00:00 2001 From: wwwcg Date: Wed, 12 Jun 2024 20:03:33 +0800 Subject: [PATCH 2/2] fix(ios): add CSS name matching semantics to fontFamily of TextInput --- .../textinput/HippyTextViewManager.mm | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/renderer/native/ios/renderer/component/textinput/HippyTextViewManager.mm b/renderer/native/ios/renderer/component/textinput/HippyTextViewManager.mm index 98299687dcc..56f21a09f1f 100644 --- a/renderer/native/ios/renderer/component/textinput/HippyTextViewManager.mm +++ b/renderer/native/ios/renderer/component/textinput/HippyTextViewManager.mm @@ -185,23 +185,30 @@ - (HippyShadowView *)shadowView { } HIPPY_CUSTOM_SHADOW_PROPERTY(fontFamily, NSString, HippyShadowTextView) { - view.font = [HippyFont updateFont:view.font withFamily:json]; + // Convert fontName to fontFamily if needed + NSString *familyName = [self familyNameWithCSSNameMatching:json]; + view.font = [HippyFont updateFont:view.font withFamily:familyName]; } HIPPY_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, HippyBaseTextInput) { UIFont *theFont = [HippyFont updateFont:view.font withSize:json ?: @(defaultView.font.pointSize)]; view.font = theFont; } + HIPPY_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused HippyBaseTextInput) { UIFont *theFont = [HippyFont updateFont:view.font withWeight:json]; // defaults to normal view.font = theFont; } + HIPPY_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused HippyBaseTextInput) { UIFont *theFont = [HippyFont updateFont:view.font withStyle:json]; view.font = theFont; // defaults to normal } + HIPPY_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, HippyBaseTextInput) { - view.font = [HippyFont updateFont:view.font withFamily:json ?: defaultView.font.familyName]; + // Convert fontName to fontFamily if needed + NSString *familyName = [self familyNameWithCSSNameMatching:json]; + view.font = [HippyFont updateFont:view.font withFamily:familyName ?: defaultView.font.familyName]; } - (HippyViewManagerUIBlock)uiBlockToAmendWithShadowView:(HippyShadowView *)hippyShadowView { @@ -211,4 +218,24 @@ - (HippyViewManagerUIBlock)uiBlockToAmendWithShadowView:(HippyShadowView *)hippy viewRegistry[componentTag].contentInset = padding; }; } + + +#pragma mark - Private + +/// Get the +/// JS side usually pass a `fontName` instead of `fontFamily` +/// - Parameter json: id +- (NSString *)familyNameWithCSSNameMatching:(id)json { + NSString *familyName = json; + if (json && ![[UIFont familyNames] containsObject:json]) { + // Not a real FamilyName + // Using CSS name matching semantics. + // fontSize here is just a placeholder for getting font. + UIFont *cssFont = [UIFont fontWithName:json size:14.0]; + familyName = cssFont.familyName; + } + return familyName; +} + + @end