这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Aniganesh
Copy link
Contributor

@Aniganesh Aniganesh commented Mar 6, 2025

Description

Screenshots

Demo page:

Checklist

  • I have manually tested this, including by generating a new app locally (see docs).

@Aniganesh Aniganesh changed the title Allow passing a ref to the Text prop Allow passing a ref prop to the Text component Mar 6, 2025
@Aniganesh Aniganesh marked this pull request as ready for review March 6, 2025 09:52
@coolsoftwaretyler coolsoftwaretyler self-requested a review March 7, 2025 01:05
Copy link
Contributor

@coolsoftwaretyler coolsoftwaretyler left a 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.

*/
export function Text(props: TextProps) {
export const Text = forwardRef(function Text(
props: PropsWithChildren<TextProps>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
props: PropsWithChildren<TextProps>,
props: TextProps,

suggestion: I don't think we need PropsWithChildren here since we already have it in the TextProps interface

export function Text(props: TextProps) {
export const Text = forwardRef(function Text(
props: PropsWithChildren<TextProps>,
ref: ForwardedRef<RNText | null>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 = () => {
Copy link
Contributor

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 = () => {
Copy link
Contributor

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.

demoIcon: {
description:
"Un composant pour faire le rendu dune 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 />.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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 dune 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.

text3:
"Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.",
},
refs: {
Copy link
Contributor

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.

Copy link
Contributor

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.

text3:
"Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.",
},
refs: {
Copy link
Contributor

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(() => {
Copy link
Contributor

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.

Copy link
Contributor

@frankcalise frankcalise left a 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.

text3:
"Eiusmod occaecat laboris eu ex veniam ipsum adipisicing consectetur. Magna ullamco adipisicing tempor adipisicing.",
},
refs: {
Copy link
Contributor

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.

@Aniganesh
Copy link
Contributor Author

Aniganesh commented Mar 7, 2025 via email

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@frankcalise frankcalise merged commit a1a220b into infinitered:master Mar 12, 2025
1 check passed
infinitered-circleci pushed a commit that referenced this pull request Mar 12, 2025
## [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))
@infinitered-circleci
Copy link
Collaborator

🎉 This PR is included in version 10.1.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing ref to Text component in Ignite boilerplate

5 participants