redux-form

How to load previous values in Redux From Field on screen and get the new values as users enter them?

和自甴很熟 提交于 2019-12-24 22:05:41
问题 I am trying to load my previous values in Redux From Fields on screen and hoping to get new values from each fields as a user updates the values. I have tried couple different ways, like onChange or initialValues but so far I still have no luck to get it working: Here is my code so far: `import _ from 'lodash'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { reduxForm, Field } from 'redux-form'; import { Link } from 'react-router-dom'; import

react-select does not clear value when redux-form is reset

橙三吉。 提交于 2019-12-24 19:14:49
问题 I have a stateless React function to render a react-select Select to a form. Everything else works nicely with redux-form except when redux-form is reset. I need to reset the form manually after successful post. onChange and onBlur change the redux-form value correctly when Select has a value change. When I reset the redux-form, the redux-form value is cleared but the Select will have the old value. function SelectInput(props) { const { input, options, label } = props; const { onChange,

React/Redux—Individual state for each Instance of a Component

老子叫甜甜 提交于 2019-12-24 12:29:41
问题 If have a list of users and each Entry has a button »EDIT«. If the user clicks on it the following happens: request the server for the form Add the component <UserEditForm /> to the entry, what expands the entry This works fine except one thing: If one clicks further buttons each Instance of the form receives the data of the last user form requested. That is because I have only only one userform property in the state. So to solve this I want to exchange userform to userforms which should

redux-form - asyncBlurFields with FieldArray Component

泄露秘密 提交于 2019-12-24 08:28:19
问题 I'm wondering how to get async validation to trigger on a Field component inside of a FieldArray. I have something like: class MyForm extends Component { constructor(props) { super(props) } render() { const { handleSubmit } = this.props return ( <form onSubmit={handleSubmit}> <Field name="name" type="text" component={RenderInputField} /> <FieldArray name="hobbies" component={RenderHobbies} /> </form> ) } } MyFormBase = reduxForm ({ form: 'MyForm', validate, asyncValidate, asyncBlurFields: [

is there any way to have redux-form ignore dots in a field name?

痞子三分冷 提交于 2019-12-24 07:47:11
问题 i have a restful api that accepts dotted(path) strings as parameter keys. for example, i can call this: /widgets?material.type=iron so i have a redux-form field like: <Field name="material.type" component={TextField} label="material type" /> but redux-form interprets the dot in material.type and when passed to my handler ends up as {material: {type: 'iron'}} . i understand why this is the default behavior, but i was wondering if there is an easy way to thwart it with a property or something

Redux Form in react native, onChangeText with Value not work correcly

泪湿孤枕 提交于 2019-12-24 05:59:50
问题 I use TextInput with onChangeText and Value, Value for use initialValues, and onChangeText for change this value. When I only use onChangeText without Value, it works correcly, but when I use onChangeText and Value it doen't works correcly. I upload image that show the error. I want write "Hi, How are you?" You can see the error in the following link: https://i.stack.imgur.com/MiVNn.gif My code: import { Field, reduxForm } from 'redux-form'; import { connect } from 'react-redux'; const

You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports

陌路散爱 提交于 2019-12-23 14:45:20
问题 import React from 'react'; import ReactDOM from 'react-dom'; import { createStore } from 'redux'; import createHistory from 'history/createBrowserHistory'; import { Provider } from 'react-redux'; import ConnectedRouter from 'react-router-redux'; import { Route, Switch } from 'react-router'; import Home from "./pages/Home"; import Register from "./pages/Register"; import CourseManagerDashboard from "./pages/CourseManagerDashboard"; import CourseDetail from "./pages/CourseDetail"; import App

How to reset initial value in redux form

允我心安 提交于 2019-12-23 06:52:48
问题 I'm using redux-form. I'm showing initial values in input fields from the state. When I click on reset, the input field is still showing initial values. How can I reset the input field? This is my code : const mapStateToProps = (state) => { return { initialValues: { name:state.userInfo.data.name, email:state.userInfo.data.email, phone:state.userInfo.data.phone, city:state.userInfo.data.city.name, } }; } This is how I'm calling initial value in the input field. const renderField = ({ input,

How to reset initial value in redux form

感情迁移 提交于 2019-12-23 06:51:39
问题 I'm using redux-form. I'm showing initial values in input fields from the state. When I click on reset, the input field is still showing initial values. How can I reset the input field? This is my code : const mapStateToProps = (state) => { return { initialValues: { name:state.userInfo.data.name, email:state.userInfo.data.email, phone:state.userInfo.data.phone, city:state.userInfo.data.city.name, } }; } This is how I'm calling initial value in the input field. const renderField = ({ input,

Redirect after submit success redux-form

混江龙づ霸主 提交于 2019-12-22 08:00:03
问题 I would like to ask if this is the proper way to redirect to another page after redux-form submit success: const form = reduxForm({ form: 'HeroesCreateComponentForm', validate, onSubmitSuccess: () => { console.log('onSubmitSuccess called (yes, yes I do get called'); browserHistory.push('/') }, }); 回答1: Did you try using next approach? react-router-redux import {push} from 'react-router-redux'; onSubmitSuccess has dispatch function as second parameter. See Redux form. onSubmitSuccess