UNPKG

react-number-field

Version:
45 lines (34 loc) 990 B
'use strict'; import React from 'react' import { render } from 'react-dom' var NumberField = require('./src') var VALUE = '' var App = React.createClass({ onChange: function(value){ VALUE = value this.setState({}) }, handleValidityChange: function(valid, value, props){ if (!valid){ VALUE = value + '!' this.setState({}) } }, render: function() { function fn(value){ // return false } var style = { textAlign: 'right' } return ( <div className="App" style={{padding: 10}}> <NumberField allowFloat={false} requireFocusOnStep={false} onValidityChange={this.handleValidityChange} name="numero" placeholder="test" value={VALUE} onChange={this.onChange} xonInvalid={fn}/> </div> ) } }) render(<App />, document.getElementById('content'))