-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
Sorry - got broken tests. Will fix and then reopen. In the meantime if you think there is an alternative way of achieving this then do let me know. |
@UsmanJ Are you still using Formik? And are you using the latest version of the component I wrote to wrap the date fields for compatibility with Formik? No worries if not, just trying to get a better understanding of what your setup is here |
@UsmanJ This is the code for the DateField wrapper I had started: https://gist.github.com/andymantell/278e67a9b4617e54fe3ddfbf858d0b37 |
Basically, this is at the heart of issue #4
|
@andymantell Yes we are continuing to use Formik. Oh I see, so rather than using |
Yes exactly that - what the DateField wrapper does is present those three fields as a single field to Formik rather than the separate date components. If you look at the later versions of the code we pushed you should see this working. Doesn't have to be done that way, but that was how I had tackled it initially. The Date component is a tricky one though - I think the issue with your proposal here is that it makes assumptions about the surrounding form code that may not hold true for everyone. It's a seemingly simple change but it's making my brain hurt thinking about what issues it may cause. I think probably what I need to do is to set up a demo with Formik as well as maybe another popular form library, and no library at all and see if there's a way to make this component work well with all of them. Perhaps the DateField wrapper actually lives in this repository alongside the base component... |
Yes I agree, and tbh I did expect you to have this hesitation towards adding a I think adding the DateField in this repository is a good idea. I'll give this way a go after lunch and will let you know how it goes. |
That'd be great if you could let me know how it goes. We can use that gist as the starting point and iterate from there. I don't mind adding Formik specific wrappers to this repository so long as the base components remain as framework agnostic as possible. |
Yes for sure.
I will update you later today or Monday to let you know how it's worked out.
Thanks for your input.
Usman Jamil
M: +44 7415121250
…________________________________
From: Andy Mantell <notifications@github.com>
Sent: Friday, February 14, 2020 12:58:38 PM
To: surevine/govuk-react-jsx <govuk-react-jsx@noreply.github.com>
Cc: Usman Jamil <usman.jamil@live.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [surevine/govuk-react-jsx] Added a defaultValue attributte (#44)
That'd be great if you could let me know how it goes. We can use that gist as the starting point and iterate from there. I don't mind adding Formik specific wrappers to this repository so long as the base components remain as framework agnostic as possible.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#44?email_source=notifications&email_token=ADDYDQSXPUXP3U3PSYJ3U7TRC2IP5A5CNFSM4KVF2M52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELY6DHA#issuecomment-586277276>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADDYDQUMMY4HNTW6EBPE73DRC2IP5ANCNFSM4KVF2M5Q>.
|
Had to add a
defaultValue
attribute and access thedefaultValue
object being passed through on theInput
because theInput
is a product of the mapping ofdateInputItems
. This is because otherwise when you go back to a page using theDateInput
component, the values are not mapped correctly due to it using a list.