Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何不允许用户使用选择选项在输入字段中输入值_Javascript_Reactjs_React Day Picker - Fatal编程技术网

Javascript 如何不允许用户使用选择选项在输入字段中输入值

Javascript 如何不允许用户使用选择选项在输入字段中输入值,javascript,reactjs,react-day-picker,Javascript,Reactjs,React Day Picker,我使用react day picker(DayPickerInput组件),我希望当用户单击相关字段时,当day picker窗口打开时,用户将无法使用键盘输入值,并且可以通过弹出窗口更改值 我不知道这是DayPickerInput的属性(我搜索了但没有找到),还是字段本身的常规属性…好, 我只需要像这样添加readOnly: <DayPickerInput readOnly // just it!! dayPickerProps={{localeUtils: Moment

我使用react day picker(DayPickerInput组件),我希望当用户单击相关字段时,当day picker窗口打开时,用户将无法使用键盘输入值,并且可以通过弹出窗口更改值

我不知道这是DayPickerInput的属性(我搜索了但没有找到),还是字段本身的常规属性…

好, 我只需要像这样添加readOnly:

<DayPickerInput
    readOnly // just it!!
    dayPickerProps={{localeUtils: MomentLocaleUtils, locale:"he"}}
    className={theme.dayPicker}
    placeholder={this.props.hintText}               
    value={value}
    onDayChange={(date: moment.Moment) => this.handleChange(date.toDate())}>                    
</DayPickerInput>  
this.handleChange(date.toDate())}>
(