Ajoute un debounce sur les champs de valeur dans les questions
parent
239515a179
commit
c8ccac62b1
|
@ -33,7 +33,7 @@ export default withLanguage(
|
|||
})
|
||||
this.previousValue = null
|
||||
this.timeoutId = null
|
||||
}, 200)
|
||||
}, 250)
|
||||
}
|
||||
format = value => {
|
||||
return value == null
|
||||
|
@ -73,7 +73,7 @@ class Evaporate extends PureComponent<{ children: string, style: Object }> {
|
|||
return (
|
||||
<ReactCSSTransitionGroup
|
||||
transitionName="evaporate"
|
||||
transitionEnterTimeout={1000}
|
||||
transitionEnterTimeout={1300}
|
||||
transitionLeaveTimeout={1}>
|
||||
<span
|
||||
key={this.props.children}
|
||||
|
|
|
@ -43,18 +43,16 @@ export var FormDecorator = formType => RenderField =>
|
|||
}
|
||||
render() {
|
||||
let {
|
||||
setFormValue,
|
||||
stepAction,
|
||||
subquestion,
|
||||
valueType,
|
||||
defaultValue,
|
||||
fieldName,
|
||||
inversion,
|
||||
setFormValue,
|
||||
themeColours
|
||||
} = this.props
|
||||
|
||||
let validate = buildValidationFunction(valueType)
|
||||
|
||||
let submit = cause => stepAction('fold', fieldName, cause),
|
||||
stepProps = {
|
||||
...this.props,
|
||||
|
|
|
@ -3,6 +3,7 @@ import withColours from 'Components/utils/withColours'
|
|||
import { compose } from 'ramda'
|
||||
import React, { Component } from 'react'
|
||||
import { withI18n } from 'react-i18next'
|
||||
import { debounce } from '../../utils'
|
||||
import { FormDecorator } from './FormDecorator'
|
||||
import InputSuggestions from './InputSuggestions'
|
||||
import SendButton from './SendButton'
|
||||
|
@ -13,6 +14,7 @@ export default compose(
|
|||
withColours
|
||||
)(
|
||||
class Input extends Component {
|
||||
debouncedOnChange = debounce(750, this.props.input.onChange)
|
||||
render() {
|
||||
let {
|
||||
input,
|
||||
|
@ -27,16 +29,18 @@ export default compose(
|
|||
suffixed = answerSuffix != null,
|
||||
inputError = dirty && error,
|
||||
submitDisabled = !dirty || inputError
|
||||
|
||||
return (
|
||||
<span>
|
||||
<div className="answer">
|
||||
<input
|
||||
ref={el => {
|
||||
this.inputElement = el
|
||||
}}
|
||||
type="text"
|
||||
{...input}
|
||||
key={input.value}
|
||||
autoFocus
|
||||
defaultValue={input.value}
|
||||
onChange={e => {
|
||||
e.persist()
|
||||
this.debouncedOnChange(e)
|
||||
}}
|
||||
className={classnames({ suffixed })}
|
||||
id={'step-' + dottedName}
|
||||
inputMode="numeric"
|
||||
|
|
|
@ -9,11 +9,11 @@ export let parseDataAttributes = (value: any) =>
|
|||
value === 'undefined'
|
||||
? undefined
|
||||
: value === null
|
||||
? null
|
||||
: !isNaN(value)
|
||||
? +value
|
||||
: /* value is a normal string */
|
||||
value
|
||||
? null
|
||||
: !isNaN(value)
|
||||
? +value
|
||||
: /* value is a normal string */
|
||||
value
|
||||
|
||||
export let getIframeOption = (optionName: string) => {
|
||||
let url = getUrl(),
|
||||
|
|
Loading…
Reference in New Issue