@@ -43,6 +43,7 @@ constexpr float loadingActivitySize = 12.0f;
4343constexpr float loadingActivityHorizontalOffset = 16 .0f ;
4444constexpr float loadingBarHeight = 36 .0f ;
4545constexpr float loadingBarFontSize = 20 .0f ;
46+ constexpr float loadingBarMinFontSize = 8 .0f ;
4647constexpr float loadingTextHorizontalOffset = 48 .0f ;
4748
4849// ! This class ensures that we access ReactRootView from UI thread.
@@ -611,6 +612,14 @@ facebook::react::AttributedStringBox CreateLoadingAttributedString() noexcept {
611612 return facebook::react::AttributedStringBox{attributedString};
612613}
613614
615+ facebook::react::ParagraphAttributes CreateLoadingParagraphAttributes () noexcept {
616+ facebook::react::ParagraphAttributes pa;
617+ pa.adjustsFontSizeToFit = true ;
618+ pa.minimumFontSize = loadingBarMinFontSize;
619+ pa.maximumFontSize = loadingBarFontSize;
620+ return pa;
621+ }
622+
614623facebook::react::Size ReactNativeIsland::MeasureLoading (
615624 const winrt::Microsoft::ReactNative::LayoutConstraints &layoutConstraints) const noexcept {
616625 facebook::react::LayoutConstraints fbLayoutConstraints;
@@ -619,7 +628,7 @@ facebook::react::Size ReactNativeIsland::MeasureLoading(
619628 auto attributedStringBox = CreateLoadingAttributedString ();
620629 winrt::com_ptr<::IDWriteTextLayout> textLayout;
621630 facebook::react::TextLayoutManager::GetTextLayout (
622- attributedStringBox, {} /* paragraphAttributes */ , fbLayoutConstraints, textLayout);
631+ attributedStringBox, CreateLoadingParagraphAttributes () , fbLayoutConstraints, textLayout);
623632
624633 DWRITE_TEXT_METRICS tm;
625634 winrt::check_hresult (textLayout->GetMetrics (&tm));
@@ -701,7 +710,7 @@ Composition::Experimental::IDrawingSurfaceBrush ReactNativeIsland::CreateLoading
701710
702711 winrt::com_ptr<::IDWriteTextLayout> textLayout;
703712 facebook::react::TextLayoutManager::GetTextLayout (
704- attributedStringBox, {} /* paragraphAttributes */ , constraints, textLayout);
713+ attributedStringBox, CreateLoadingParagraphAttributes () , constraints, textLayout);
705714
706715 DWRITE_TEXT_METRICS tm;
707716 textLayout->GetMetrics (&tm);
0 commit comments