redux-form

Wrapping UI components to use with Redux Form, and use custom onChange event functions

 ̄綄美尐妖づ 提交于 2020-01-15 09:27:55
问题 The following is a custom dropdown menu that I would like to make compatible with Redux Form, as well as execute custom onChange function (e.g.: dispatch an action) <Select label='Team' name='team' options={teamOptions} placeholder='Team' onClick={this.handleTeamClick} /> In a first step, I created the wrapper as follows: export const rfSelect = ({ input, options, meta, ...rest }) => ( <Select {...input} onChange={(e,v) => input.onChange(v.value)} options={options} {...rest} /> ) where the

Wrapping UI components to use with Redux Form, and use custom onChange event functions

╄→гoц情女王★ 提交于 2020-01-15 09:27:05
问题 The following is a custom dropdown menu that I would like to make compatible with Redux Form, as well as execute custom onChange function (e.g.: dispatch an action) <Select label='Team' name='team' options={teamOptions} placeholder='Team' onClick={this.handleTeamClick} /> In a first step, I created the wrapper as follows: export const rfSelect = ({ input, options, meta, ...rest }) => ( <Select {...input} onChange={(e,v) => input.onChange(v.value)} options={options} {...rest} /> ) where the

Dynamically generate radio buttons

为君一笑 提交于 2020-01-15 06:36:22
问题 I have a redux form where I included some radio buttons: <label htmlFor="passType">Pass type</label> {passType.touched && passType.error && <span className="error">{passType.error}</span>} <br /> <input type="radio" {...passType} id="passType" value="0" checked={passType.value === '0'} /> VIP<br /> <input {...passType} type="radio" id="passType" value="1" checked={passType.value === '1'} /> Regular<br /> All well and good, but now the pass types must be dynamically generated from state:

React Datepicker with redux-form

我们两清 提交于 2020-01-13 07:15:34
问题 How to make the react-datepicker bind with redux-form? I have this redux-form field: <Field name="due_date" component={props => <DatePicker {...props} readOnly={true} selected={this.state.due_date} value={this.state.due_date} onChange={this.handleDueDate} /> } /> Whenever i submit the redux form does return an empty object not binding the datepicker's value... my onChange : handleDueDate(date) { this.setState({ due_date: moment(date).format('L') }, () => { // do I need to dispatch and action

Access prop outside of class in React when calling Higher Order Component

这一生的挚爱 提交于 2020-01-12 19:28:27
问题 I am trying to use a Higher Order Component(HOC) pattern to reuse some code that connects to state and uses the Redux Form formValueSelector method. formValueSelector requires a sting referencing the name of the form. I would like to set this dynamically and be able to use this HOC whenever I need the values of items. I use the item values to make calculations. In the code below the HOC is passed the component and a string. I would like to set this to the prop formName that has been passed in

Access prop outside of class in React when calling Higher Order Component

China☆狼群 提交于 2020-01-12 19:28:25
问题 I am trying to use a Higher Order Component(HOC) pattern to reuse some code that connects to state and uses the Redux Form formValueSelector method. formValueSelector requires a sting referencing the name of the form. I would like to set this dynamically and be able to use this HOC whenever I need the values of items. I use the item values to make calculations. In the code below the HOC is passed the component and a string. I would like to set this to the prop formName that has been passed in

multiple Redux-form with formValueSelector

北战南征 提交于 2020-01-06 14:20:13
问题 I'm trying to create multiple forms that have dependable dropdowns. Based on selection on dropdown1, some fields are shown and another dropdown is populated. To achieve the multiple forms, I have to pass a unique form key such as: panels.map(panel => <PanelForm key={panel.uuid} form={`PanelForm_${panel.uuid}`} /> ) However, to connect to state for changes, I have to use the redux formValueSelector which requires to set it to the form name passed which is dynamic and I don't know how to pass

Redux form validation runs after onChange handler function

≡放荡痞女 提交于 2020-01-06 08:44:22
问题 I have the following redux form: import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Field, reduxForm, getFormSyncErrors } from 'redux-form'; import { createExpense } from '../../actions'; import { validateName, validateImage } from '../../helpers/expense_utils'; import { renderInputField, validate, renderTextAreaField, renderDropzoneField } from '../../helpers/form_utils'; const validators = [ { field: 'title', validator: validateName }, { field:

React Native, redux form, native base - onChange(event) function doesnt work,undefined is not an object evaluating event.target.value

こ雲淡風輕ζ 提交于 2020-01-06 06:04:44
问题 CHANGED, STILL NO ANSWER I followed this example: https://jsfiddle.net/4np9u17g/11/ I want to make it like there - after inputing value focus should go to next input. I use new syntax of refs and redux form, what am i doing wrong? constructor() { super(); this.field1 = React.createRef(); this.field2 = React.createRef(); this.field3 = React.createRef(); this.field4 = React.createRef(); this.field5 = React.createRef(); this.field6 = React.createRef(); } On change function (I made it really

React Native, redux form, native base - onChange(event) function doesnt work,undefined is not an object evaluating event.target.value

狂风中的少年 提交于 2020-01-06 06:03:48
问题 CHANGED, STILL NO ANSWER I followed this example: https://jsfiddle.net/4np9u17g/11/ I want to make it like there - after inputing value focus should go to next input. I use new syntax of refs and redux form, what am i doing wrong? constructor() { super(); this.field1 = React.createRef(); this.field2 = React.createRef(); this.field3 = React.createRef(); this.field4 = React.createRef(); this.field5 = React.createRef(); this.field6 = React.createRef(); } On change function (I made it really