react-component/form

validateTrigger 'onBlur' can't use In react-native TextInput

Open

#157 aperta il 13 apr 2018

Vedi su GitHub
 (5 commenti) (3 reazioni) (1 assegnatario)JavaScript (300 fork)batch import
help wanted

Metriche repository

Star
 (1801 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I use the example of the react-native. After add validateTrigger, the value always to be empty, when the TextInput blur.

"react": "^16.2.0", "react-native": "0.53.3", "rc-form": "^2.1.7",

{getFieldDecorator('username', {
          validateFirst: true,
          validateTrigger: 'onBlur', // **add code here**
          rules: [
            { required: true, message: '请输入手机号!' },
            {
              pattern: /^1\d{10}$/,
              message: '请输入正确的手机号!',
            },
            {
              validator: (rule, value, callback) => {
                this.checkUserNameOne(value, callback);
              },
              message: '手机号已经被注册!',
            },
          ],
        })(
          <FromItem
            autoFocus
            placeholder="手机号"
            error={getFieldError('username')}
          />
        )}

Can you help me to explain it?

Guida contributor