UNPKG

formsy-material-ui-react16

Version:

A formsy-react compatibility wrapper for Material-UI form components with React 16

26 lines (21 loc) 565 B
import React from 'react'; export default class FormsyComponent extends React.Component { setMuiComponentAndMaybeFocus = c => { if (c === this.muiComponent) return; this.muiComponent = c; if (c && typeof c.focus === 'function') { this.focus = () => c.focus(); } else if (this.hasOwnProperty('focus')) { delete this.focus; } }; debounce = (fn, delay) => { let timeout; return (...args) => { clearTimeout(timeout); timeout = setTimeout(() => { fn.apply(this, args); }, delay); }; }; }