react-native-form-generator icon indicating copy to clipboard operation
react-native-form-generator copied to clipboard

setTime does not work for TimePicker

Open nickrobinson352 opened this issue 8 years ago • 2 comments

the setTime API in TimePicker does not work for ios as there is a missing ref in TimePickerField.ios.js.

 setTime(date){
    this.refs.datePickerComponent.setDate(date);
  }

return(<DatePickerComponent
      {...this.props}
      mode="time"
 => ref='datePickerComponent'
      labelStyle={[formStyles.fieldText, this.props.labelStyle]}
      valueStyle = {[formStyles.fieldValue,this.props.valueStyle]}
      valueContainerStyle = {[formStyles.alignRight,
          formStyles.horizontalContainer, this.props.valueContainerStyle]}
      containerStyle={[
        formStyles.fieldContainer,
        formStyles.horizontalContainer,
        this.props.containerStyle,
      ]}
      />)

nickrobinson352 avatar Mar 19 '17 01:03 nickrobinson352

Android, too. My code: this.refs.registrationForm.refs.timeMeeting.setTime(new Date()); My error: screenshot_20171219-170237

pnthach95 avatar Dec 19 '17 10:12 pnthach95

Just raised PR #134 with the fix for those who need it

dchersey avatar Sep 12 '18 20:09 dchersey