Skip to content

Commit 0665ef8

Browse files
committed
Fire onBlur in more situations.
Automatic Example Update
1 parent 8b7ddf2 commit 0665ef8

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

example/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const App = React.createClass({
6868
<Col sm={6}>
6969
<FormGroup>
7070
<ControlLabel>{this.state.focused ? "Focused" : "Blurred"}</ControlLabel>
71-
<DatePicker placeholder="Placeholder" value={this.state.date} onFocus={() => {this.setState({focused: true})}} onBlur={() => {this.setState({focused: false})}} />
71+
<DatePicker onChange={this.handleChange} placeholder="Placeholder" value={this.state.date} onFocus={() => {this.setState({focused: true})}} onBlur={() => {this.setState({focused: false})}} />
7272
<HelpBlock>This is {this.state.focused ? "focused" : "blurred"}.</HelpBlock>
7373
</FormGroup>
7474
</Col>

lib/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ exports.default = _react2.default.createClass({
255255
this.setState({
256256
focused: false
257257
});
258+
if (this.props.onBlur) {
259+
this.props.onBlur(e);
260+
}
258261
}
259262
},
260263
handleFocus: function handleFocus(e) {
@@ -381,6 +384,9 @@ exports.default = _react2.default.createClass({
381384
value: newSelectedDate.toISOString(),
382385
focused: false
383386
});
387+
if (this.props.onBlur) {
388+
this.props.onBlur(new Event("Change Date"));
389+
}
384390
if (this.props.onChange) {
385391
this.props.onChange(newSelectedDate.toISOString());
386392
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"picker"
1212
],
1313
"main": "lib/index.js",
14-
"version": "3.0.2",
14+
"version": "3.0.3",
1515
"description": "React-Bootstrap based date picker.",
1616
"directories": {
1717
"test": "test"

src/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ export default React.createClass({
206206
this.setState({
207207
focused: false
208208
});
209+
if(this.props.onBlur) {
210+
this.props.onBlur(e);
211+
}
209212
}
210213
},
211214
handleFocus(e){
@@ -329,6 +332,9 @@ export default React.createClass({
329332
value: newSelectedDate.toISOString(),
330333
focused: false
331334
});
335+
if(this.props.onBlur) {
336+
this.props.onBlur(new Event("Change Date"));
337+
}
332338
if(this.props.onChange) {
333339
this.props.onChange(newSelectedDate.toISOString());
334340
}

0 commit comments

Comments
 (0)