diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index ede2500ee5c2c8..e42b6ac5995692 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -22,8 +22,6 @@ var View = require('View'); var requireNativeComponent = require('requireNativeComponent'); -var DATEPICKER = 'datepicker'; - type DefaultProps = { mode: 'date' | 'time' | 'datetime'; }; @@ -108,8 +106,8 @@ var DatePickerIOS = React.createClass({ // certain values. In other words, the embedder of this component should // be the source of truth, not the native component. var propsTimeStamp = this.props.date.getTime(); - if (nativeTimeStamp !== propsTimeStamp) { - this.refs[DATEPICKER].setNativeProps({ + if (this._picker && nativeTimeStamp !== propsTimeStamp) { + this._picker.setNativeProps({ date: propsTimeStamp, }); } @@ -120,7 +118,7 @@ var DatePickerIOS = React.createClass({ return ( this._picker = picker } style={styles.datePickerIOS} date={props.date.getTime()} maximumDate={ diff --git a/Libraries/Picker/PickerIOS.ios.js b/Libraries/Picker/PickerIOS.ios.js index 5c245397d0b0a1..ffda1f57d174d5 100644 --- a/Libraries/Picker/PickerIOS.ios.js +++ b/Libraries/Picker/PickerIOS.ios.js @@ -21,8 +21,6 @@ var View = require('View'); var requireNativeComponent = require('requireNativeComponent'); -var PICKER = 'picker'; - var PickerIOS = React.createClass({ mixins: [NativeMethodsMixin], @@ -57,7 +55,7 @@ var PickerIOS = React.createClass({ return ( this._picker = picker } style={styles.pickerIOS} items={this.state.items} selectedIndex={this.state.selectedIndex} @@ -81,8 +79,8 @@ var PickerIOS = React.createClass({ // disallow/undo/mutate the selection of certain values. In other // words, the embedder of this component should be the source of // truth, not the native component. - if (this.state.selectedIndex !== event.nativeEvent.newIndex) { - this.refs[PICKER].setNativeProps({ + if (this._picker && this.state.selectedIndex !== event.nativeEvent.newIndex) { + this._picker.setNativeProps({ selectedIndex: this.state.selectedIndex }); }