Skip to content

Commit

Permalink
[DatePicker] Prevent datepicker from switching the TextField from unc…
Browse files Browse the repository at this point in the history
…ontrolled to controlled by changing the fallback value to an empty string, fixed a few documentation issues
  • Loading branch information
nathanmarks committed Apr 12, 2016
1 parent cbf332d commit 851c758
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ export default class DatePickerExampleToggle extends React.Component {
<div style={optionsStyle}>
<TextField
floatingLabelText="Min Date"
defaultValue={this.state.minDate.toDateString()}
value={this.state.minDate.toDateString()}
onChange={this.handleChangeMinDate}
/>
<TextField
floatingLabelText="Max Date"
defaultValue={this.state.maxDate.toDateString()}
value={this.state.maxDate.toDateString()}
onChange={this.handleChangeMaxDate}
/>
<Toggle
name="autoOk"
value="autoOk"
label="Auto Accept"
defaultToggled={this.state.autoOk}
toggled={this.state.autoOk}
onToggle={this.handleToggle}
/>
<Toggle
name="disableYearSelection"
value="disableYearSelection"
label="Disable Year Selection"
defaultToggled={this.state.disableYearSelection}
toggled={this.state.disableYearSelection}
onToggle={this.handleToggle}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/DatePicker/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class DatePicker extends React.Component {
{...other}
style={textFieldStyle}
ref="input"
value={this.state.date ? formatDate(this.state.date) : undefined}
value={this.state.date ? formatDate(this.state.date) : ''}
onFocus={this.handleFocus}
onTouchTap={this.handleTouchTap}
/>
Expand Down

0 comments on commit 851c758

Please sign in to comment.