Skip to content

Commit

Permalink
Fix I/F
Browse files Browse the repository at this point in the history
  • Loading branch information
s4kr4 committed Jun 14, 2017
1 parent 8e05899 commit 53bc1d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
26 changes: 20 additions & 6 deletions examples/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,33 @@ import './App.css';
import InputShortcut from 'react-input-shortcut';

class App extends Component {
constructor() {
super()
this.state = {
text: ''
}
}

handleSubmit() {
console.log(this.state);
}

render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Test of "react-input-shortcut"</h2>
</div>
<div>
Alphabet + Number: <InputShortcut allowNumber />
</div>
<div>
Alphabet Only: <InputShortcut />
</div>
<form action="javascript:void(0)" onSubmit={this.handleSubmit.bind(this)}>
<div>
Alphabet + Number: <InputShortcut name="number" allowNumber />
</div>
<div>
Alphabet Only: <InputShortcut name="alphabet" value={this.state.text} />
</div>
<button type="submit">SUBMIT</button>
</form>
</div>
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/InputShortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ export default class InputShortcut extends Component {
render() {
return (
<input
type="text"
className="InputShortcut"
ref={ (ref) => this.input = ref }
value={ this.state.textValue } />
name={this.props.name}
ref={(ref) => this.input = ref}
value={this.state.textValue} />
)
}
}
Expand Down

0 comments on commit 53bc1d0

Please sign in to comment.