[redux-form] Added an optional "forceUnregisterOnUnmount" property to the

"reduxForm()" "Config" interface, as it is present in the redux-form API.
This commit is contained in:
Matt C
2017-03-10 10:05:12 +11:00
parent c66c210a25
commit d4b99f6dca
2 changed files with 25 additions and 0 deletions
+6
View File
@@ -65,6 +65,12 @@ export interface Config<FormData extends DataShape, P, S> {
*/
destroyOnUnmount?: boolean;
/**
* Whether or not to force unregistration of fields -- use in conjunction
* with destroyOnUnmount.
*/
forceUnregisterOnUnmount?: boolean;
/**
* A function that takes the entire Redux state and returns the state slice
* which corresponds to where the redux-form reducer was mounted. This
+19
View File
@@ -56,3 +56,22 @@ const MyStatelessFunctionalComponent: React.SFC<void> = () => <div/>;
reduxForm({
form: 'mySFCForm'
})(MyStatelessFunctionalComponent);
class MyReusableForm extends Component<void, undefined> {
render() {
return (
<div>
<Field
name='foo'
component='input'
placeholder='Foo bar'
/>
</div>
);
}
}
reduxForm({
form: 'forceUnregisterOnMountForm',
forceUnregisterOnUnmount: true
});