From 6e37b279ec9bda9a12fcfd3ee7ebe362c1b57633 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Wed, 21 Oct 2015 13:43:14 +0100 Subject: [PATCH] [fixed] Remove cross import between Button & ButtonInput They were importing each other which causes an issue when using ButtonInput for server side react rendering under node. Possibly not an issue when they are bundled into the same client side file. We remove the import Button and move the definition of the 'types' into Button which is then referenced from ButtonInput as that already has to import Button. We keep the ButtonInput.types to preserve the interface. --- src/Button.js | 7 +++++-- src/ButtonInput.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Button.js b/src/Button.js index ed41f5a68e..940cf9d57c 100644 --- a/src/Button.js +++ b/src/Button.js @@ -2,7 +2,8 @@ import React from 'react'; import classNames from 'classnames'; import BootstrapMixin from './BootstrapMixin'; import elementType from 'react-prop-types/lib/elementType'; -import ButtonInput from './ButtonInput'; + +const types = ['button', 'reset', 'submit']; const Button = React.createClass({ mixins: [BootstrapMixin], @@ -24,7 +25,7 @@ const Button = React.createClass({ * @type {("button"|"reset"|"submit")} * @defaultValue 'button' */ - type: React.PropTypes.oneOf(ButtonInput.types) + type: React.PropTypes.oneOf(types) }, getDefaultProps() { @@ -101,4 +102,6 @@ const Button = React.createClass({ } }); +Button.types = types; + export default Button; diff --git a/src/ButtonInput.js b/src/ButtonInput.js index c323c83bab..0ad24a09e1 100644 --- a/src/ButtonInput.js +++ b/src/ButtonInput.js @@ -17,7 +17,7 @@ class ButtonInput extends InputBase { } } -ButtonInput.types = ['button', 'reset', 'submit']; +ButtonInput.types = Button.types; ButtonInput.defaultProps = { type: 'button'