Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

React Redux Form v0.13.6

Compare
Choose a tag to compare
@davidkpiano davidkpiano released this 06 Jun 17:37
· 1114 commits to master since this release

Custom Components and createFieldClass()

  • If you specify the .componentMap in the defaultProps argument (second arg) of createFieldClass(propsMap, defaultProps), it will now recognize custom components based on their constructors, and not on their .displayNames (which are minified in production builds). #261 #224 #176 #161 #65
import CustomInput from '../somewhere/custom-input.js';
import { createFieldClass, controls } from 'react-redux-form';

// BEFORE:
const CustomField = createFieldClass({
  CustomInput: controls.text,
});

CustomField.displayName = 'customField'; // < 0.13.6 workaround

// AFTER:
const CustomField = createFieldClass({
  CustomInput: controls.text,
}, {
  componentMap: {
    CustomInput: CustomInput // recognize custom input from constructor
  }
});

// SHORTHAND:
const CustomField = createFieldClass({
  CustomInput: controls.text,
}, {
  componentMap: { CustomInput }
});

Bug Fixes

  • Model paths are now recognized with a custom pathStartsWith function instead of a string-comparison lodash/startsWith (#257)
  • The <input type="file" /> component now properly reads files from the event, and works as expected. (#250)