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

detecting focus on any field ? #1777

Closed
jasan-s opened this issue Sep 15, 2016 · 5 comments
Closed

detecting focus on any field ? #1777

jasan-s opened this issue Sep 15, 2016 · 5 comments
Labels

Comments

@jasan-s
Copy link

jasan-s commented Sep 15, 2016

this might be very obvious but how can i detect that field has focus , because on mobile the keyboard moves up and i need to adjust the UI accordingly.

@erikras
Copy link
Member

erikras commented Sep 15, 2016

Each Field component is given a meta.active flag that you could detect changing from false to true. Something like that?

@jasan-s
Copy link
Author

jasan-s commented Sep 15, 2016

Yes, but it would be nice if it was in the passed down props. Because if I
use mapStateToProps to pass in that in, the app throws an error on startup
because the that state has not been initialized in redux.

On Sep 15, 2016 7:51 AM, "Erik Rasmussen" notifications@github.com wrote:

Each Field component is given a meta.active
http://redux-form.com/6.0.5/docs/api/Field.md/#-meta-active-boolean-
flag that you could detect changing from false to true. Something like
that?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1777 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANOMEc7aqOM39cL7fwDGDRMudM9gMUOLks5qqVt5gaJpZM4J98-l
.

@STEVEOO6
Copy link

STEVEOO6 commented Nov 4, 2016

+1

I am looking to implement a checkout payment credit card form with a visual credit card reference (using https://github.com/JohnyDays/react-credit-card) and I need to tell the Card component which field currently holds focus (so that the visual reference can spin around to display the CVC when the user is inputting that information).

screen shot 2016-11-04 at 5 50 21 pm

Ideally the form's would receive a prop containing the entire 'state' (values, meta, errors etc) of its Fields and the user could destructure the state accordingly.

Currently I'm planning to use the parse/normalize hooks and store the focus state myself.

@danielrob
Copy link
Collaborator

Not passing all the values/meta/errors as props as a default behaviour is, to my understanding, an intentional part of the api that helps keep it performant by default. Otherwise you drift towards the v5 api which was revamped partly because of this problem.

Closing this usage question as it is nine months old since last update. There are now many ways provided to access the state information required, namely the provided selectors.

@lock
Copy link

lock bot commented Aug 4, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants