-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Allow passing a ref prop to the Text component #2909
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
Conversation
coolsoftwaretyler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Aniganesh - this looks great. Thanks for writing it up against the latest Ignite. I see you had submitted #2765 earlier. We appreciate your time!
I have a couple questions, thoughts, suggestions. I don't see anything that I consider a blocker, but I'll see if anyone else from IR wants to take a look before merge.
boilerplate/app/components/Text.tsx
Outdated
| */ | ||
| export function Text(props: TextProps) { | ||
| export const Text = forwardRef(function Text( | ||
| props: PropsWithChildren<TextProps>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| props: PropsWithChildren<TextProps>, | |
| props: TextProps, |
suggestion: I don't think we need PropsWithChildren here since we already have it in the TextProps interface
boilerplate/app/components/Text.tsx
Outdated
| export function Text(props: TextProps) { | ||
| export const Text = forwardRef(function Text( | ||
| props: PropsWithChildren<TextProps>, | ||
| ref: ForwardedRef<RNText | null>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ref: ForwardedRef<RNText | null>, | |
| ref: ForwardedRef<RNText>, |
suggestion: I don't think we want null here. RNText should suffice.
| import { useAppTheme } from "@/utils/useAppTheme" | ||
|
|
||
| // Define the TextRefDemo component outside of other function components | ||
| const TextRefDemo = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: nice! Thanks for the demo.
| import { useAppTheme } from "@/utils/useAppTheme" | ||
|
|
||
| // Define the TextRefDemo component outside of other function components | ||
| const TextRefDemo = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: maybe we should extract TextRefDemo to a separate file? I feel very neutral on this, but the other demo files seem to just be the demo objects. I'm not sure if there's a good example of something like this, though.
boilerplate/app/i18n/demo-fr.ts
Outdated
| demoIcon: { | ||
| description: | ||
| "Un composant pour faire le rendu d’une icône enregistrée. Il est enveloppé dans un <TouchableOpacity /> si `onPress` est fourni, sinon dans une <View />.", | ||
| "Un composant pour faire le rendu d'une icône enregistrée. Il est enveloppé dans un <TouchableOpacity /> si `onPress` est fourni, sinon dans une <View />.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "Un composant pour faire le rendu d'une icône enregistrée. Il est enveloppé dans un <TouchableOpacity /> si `onPress` est fourni, sinon dans une <View />.", | |
| "Un composant pour faire le rendu d’une icône enregistrée. Il est enveloppé dans un <TouchableOpacity /> si `onPress` est fourni, sinon dans une <View />.", |
suggestion: can we revert these changes? I'm not sure how much it matters, but it looks like maybe you had a format-on-save change a bunch of unrelated characters in the french localization file.
boilerplate/app/i18n/demo-ar.ts
Outdated
| text3: | ||
| "Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.", | ||
| }, | ||
| refs: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: @frankcalise - do we have a process for reviewing localization files across languages? I can run this through google translate but I'm curious if we've got a better mechanism for that across each locale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it isn't as simple as just pushing strings through Google Translate, we've reached out to various parts of the community for official translations.
I'm going to say we don't need to have a use case for this demo, just accept the forwardRef on the component and that should tidy up this PR a bunch.
boilerplate/app/i18n/demo-en.ts
Outdated
| text3: | ||
| "Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.", | ||
| }, | ||
| refs: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: thank you for doing the localization!
| setHighlighted(true) | ||
|
|
||
| // Reset highlight after a delay | ||
| setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: rather than resetting the highlight, can we make the button toggle the focus? This is a personal preference - sometimes I look away and miss a time-based demo like this. Not a blocker.
frankcalise
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating your contribution!
If you wouldn't mind, can we revert the i18n and DemoText.tsx changes. It doesn't feel necessary to demo a ref since it's not really something Ignite is offering over how React works.
It'll also help keep the maintenance down for translating more strings and we'd also have to even verify that the ones here are valid.
boilerplate/app/i18n/demo-ar.ts
Outdated
| text3: | ||
| "Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.", | ||
| }, | ||
| refs: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it isn't as simple as just pushing strings through Google Translate, we've reached out to various parts of the community for official translations.
I'm going to say we don't need to have a use case for this demo, just accept the forwardRef on the component and that should tidy up this PR a bunch.
|
Will update
…On Fri, 7 Mar, 2025, 8:02 pm Frank Calise, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Thanks for updating your contribution!
If you wouldn't mind, can we revert the i18n and DemoText.tsx changes. It
doesn't feel necessary to demo a ref since it's not really something Ignite
is offering over how React works.
It'll also help keep the maintenance down for translating more strings and
we'd also have to even verify that the ones here are valid.
------------------------------
In boilerplate/app/i18n/demo-ar.ts
<#2909 (comment)>:
> @@ -393,6 +393,13 @@ export const demoAr: DemoTranslations = {
text3:
"Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.",
},
+ refs: {
Yeah it isn't as simple as just pushing strings through Google Translate,
we've reached out to various parts of the community for official
translations.
I'm going to say we don't need to have a use case for this demo, just
accept the forwardRef on the component and that should tidy up this PR a
bunch.
—
Reply to this email directly, view it on GitHub
<#2909 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALMA3WVWO77NDETPEFKDZZD2TGUXNAVCNFSM6AAAAABYOG6TYSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMNRXGQYTONJWGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you made some unintended changes here to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
frankcalise
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
## [10.1.9](v10.1.8...v10.1.9) (2025-03-12) ### Bug Fixes * **boilerplate:** Allow passing a ref prop to the Text component ([#2909](#2909) by @Aniganesh) ([a1a220b](a1a220b))
|
🎉 This PR is included in version 10.1.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Textcomponent in Ignite boilerplate #2758Screenshots
Demo page:
Checklist