Skip to content

Commit 6e37b27

Browse files
committed
[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.
1 parent 4901d2c commit 6e37b27

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Diff for: src/Button.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import React from 'react';
22
import classNames from 'classnames';
33
import BootstrapMixin from './BootstrapMixin';
44
import elementType from 'react-prop-types/lib/elementType';
5-
import ButtonInput from './ButtonInput';
5+
6+
const types = ['button', 'reset', 'submit'];
67

78
const Button = React.createClass({
89
mixins: [BootstrapMixin],
@@ -24,7 +25,7 @@ const Button = React.createClass({
2425
* @type {("button"|"reset"|"submit")}
2526
* @defaultValue 'button'
2627
*/
27-
type: React.PropTypes.oneOf(ButtonInput.types)
28+
type: React.PropTypes.oneOf(types)
2829
},
2930

3031
getDefaultProps() {
@@ -101,4 +102,6 @@ const Button = React.createClass({
101102
}
102103
});
103104

105+
Button.types = types;
106+
104107
export default Button;

Diff for: src/ButtonInput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ButtonInput extends InputBase {
1717
}
1818
}
1919

20-
ButtonInput.types = ['button', 'reset', 'submit'];
20+
ButtonInput.types = Button.types;
2121

2222
ButtonInput.defaultProps = {
2323
type: 'button'

0 commit comments

Comments
 (0)