diff --git a/lib/Autocomplete.js b/lib/Autocomplete.js index 1658c8bb..fd9092ef 100644 --- a/lib/Autocomplete.js +++ b/lib/Autocomplete.js @@ -157,6 +157,11 @@ class Autocomplete extends React.Component { */ open: PropTypes.bool, debug: PropTypes.bool, + /** + * Arguments: `renderer: Function` + * Custom renderer for debug info + */ + renderDebug: PropTypes.func, } static defaultProps = { @@ -188,6 +193,11 @@ class Autocomplete extends React.Component { autoHighlight: true, selectOnBlur: false, onMenuVisibilityChange() {}, + renderDebug: function (debugStates) { + return
+ {JSON.stringify(debugStates.slice(Math.max(0, debugStates.length - 5), debugStates.length), null, 2)} ++ } } constructor(props) { @@ -568,7 +578,7 @@ class Autocomplete extends React.Component { }) } - const { inputProps } = this.props + const { inputProps, renderDebug } = this.props const open = this.isOpen() return (
- {JSON.stringify(this._debugStates.slice(Math.max(0, this._debugStates.length - 5), this._debugStates.length), null, 2)} -- )} + {this.props.debug && renderDebug ? renderDebug(this._debugStates) : null}