I am working with styled-components and Formik. Everything is working well except textareas or selects etc. Styled-components and Formik have got same attribute as
and when I want to connect this I am getting not expected results.
<StyledTextArea as={Field} placeholder="" name="topic" id="topic"></StyledTextArea>
Using Formik we need to pass an attribute as
for Field element as well. It should looks like this:
<Field as="textarea" id="topic" name="topic"></Field>
I fixed this with writing this:
const StyledTextareaField = (props) => (
<Field {...props} as="textarea" id="description" name="description" children={props.children}></Field>
);
and this:
<StyledTextArea
as={StyledTextareaField}
placeholder="Wpisz opis spotkania"
id="description"
name="description"
></StyledTextArea>
But my problem is that when I start typing after one letter I am losing focus from textarea and I must click once again to fill next letter etc.