[ui][iOS] Add monospacedDigit modifier#43328
[ui][iOS] Add monospacedDigit modifier#43328intergalacticspacehighway merged 3 commits intoexpo:mainfrom
monospacedDigit modifier#43328Conversation
|
Subscribed to pull request
Generated by CodeMention |
ad15cbf to
192c02b
Compare
|
|
||
| internal struct MonospacedDigitModifier: ViewModifier, Record { | ||
| func body(content: Content) -> some View { | ||
| if #available(iOS 15.0, tvOS 15.0, macOS 12.0, *) { |
There was a problem hiding this comment.
we can remove this check since min version we support is 15.0.
There was a problem hiding this comment.
done 💯
also removed the @platform 15.0+ comments then
There was a problem hiding this comment.
Thanks for the PR!
There was a problem hiding this comment.
My pleasure, thanks for the review!
| case "italic": | ||
| return text.italic() | ||
| case "monospacedDigit": | ||
| if #available(iOS 15.0, tvOS 15.0, macOS 12.0, *) { |
There was a problem hiding this comment.
same as above
192c02b to
f16af7f
Compare
intergalacticspacehighway
left a comment
There was a problem hiding this comment.
LGTM. One last thing, since a modifier is added we'll need to update the docs with below command.
et gdad -p "expo-ui/swift-ui/modifiers"I'll add a contribution guide.
done :) i tried before with |
Why
#43256
This modifier is useful for displaying numbers that change over time (timers, counters, prices) without the text shifting layout, as each digit always takes the same width.
How
Added MonospacedDigitModifier inline in
ViewModifierRegistry.swift(following the same pattern asBoldModifier/ItalicModifier), registered it in the modifier registry, added the text modifier case inapplyTextModifier, and exported it from the TS modifiers.Test Plan
I added an example in NCL > Expo UI > Modifiers
Checklist
changelog.mdentry and rebuilt the package sources according to this short guidenpx expo prebuild& EAS Build (eg: updated a module plugin).