Skip to content
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

TextInput onFocus Type is not LayoutEvent #3968

Open
joshzeldin opened this issue Jan 1, 2024 · 3 comments
Open

TextInput onFocus Type is not LayoutEvent #3968

joshzeldin opened this issue Jan 1, 2024 · 3 comments

Comments

@joshzeldin
Copy link

joshzeldin commented Jan 1, 2024

Description

According to the documentation under TextInput, the onFocus prop is supposed to accept a function that handles a LayoutEvent. However, when trying to implement the onFocus prop, it looks like it actually accepts a function that handles the NativeSyntheticEvent<TextInputFocusEventData>. This type varies significantly from the LayoutEvent type and does not include attributes such as x, y, height, width.

It would help if the documentation can explain how to extract a LayoutEvent from this other type or change the type signature to reflect the difference.

Documentation version

0.73 - https://reactnative.dev/docs/textinput#onfocus

@joshzeldin
Copy link
Author

@Simek Are you familiar with this? It looks like you've been involved in the changes to this section from the history.

I'm trying to leverage the onFocus callback to scroll my wrapping ScrollView to the appropriate place and the documented LayoutEvent data would be useful as it has x/y/height/width, but the TextInputFocusEventData type doesn't seem nearly as useful for isolating where on the page the focus occurred.

Thanks for any help you can provide. Much appreciated!!

Copy link

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Issues/PR that are not getting much activity and are closer to be closed label May 19, 2024
@joshzeldin
Copy link
Author

Is there anyone that can help answer this? I have a workaround, but I think it would be helpful if the documentation was updated or a further explanation was added.

@github-actions github-actions bot removed the Stale Issues/PR that are not getting much activity and are closer to be closed label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant