-
Notifications
You must be signed in to change notification settings - Fork 12
feat(styles): add textAlign to VoltraTextStyle #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(styles): add textAlign to VoltraTextStyle #23
Conversation
|
@mrevanzak is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
Add textAlign property to VoltraTextStyle type definition, aligning TypeScript types with existing native iOS support for text alignment in Timer and Text components. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
d340b2a to
73d7c5d
Compare
|
This is a bit complicated because Text views in SwiftUI behave differently than elements in web or React Native. They don't expand by default. They simply occupy as much space as their content requires.
We definitely need to include this property in our styles, but perhaps we should rename it to |
but it works in my case like textAlign should be :D in my case its only 1 line of text and i can make it right aligned with |
|
https://developer.apple.com/documentation/swiftui/view/multilinetextalignment(_:)
However, it turns out that if you are developing a widget and you use this modifier for a Text initialized with a date or time, it will work.
What’s your use case where it works? |
oh i see. no wonder it's worked on me. i used it on <Voltra.Timer /> |
<Voltra.Text
style={{
color: '#FFFFFF',
fontSize: 18,
fontWeight: '400',
// @ts-expect-error - textAlign is not a valid prop for Voltra.Text
textAlign: 'center',
}}
>does work fine, and no need for multilineTextAlignment="center" |
yes that's what i used right now before this one get merge @Marcados |
Summary
Add
textAlignproperty toVoltraTextStyletype definition, aligning TypeScript types with existing native iOS support.Changes
textAlignto thePick<RNTextStyle, ...>union inVoltraTextStyleProblem
The native iOS side (
JSStyleParser.swift) already supportstextAlignfor Timer and Text components, mapping values like"center","right","end"to SwiftUI'sTextAlignment. However, the TypeScript type definition was missing this property, preventing autocomplete and type-checking.Verification
textAlign↔ta) indata/components.json