Redux-form 和 form 标签:大写字母?

Redux-form and form tag : capital letter?

我想安装redux form。我仔细阅读了文档,但我仍然有错误。

Invariant Violation : View config not found for name form. Make sure to strat component names with a capital letter.

我的代码完全文档的代码,第 2 步:https://redux-form.com/7.2.2/docs/gettingstarted.md/

import React from 'react'
import { Field, reduxForm } from 'redux-form'

let ContactForm = props => {
  const { handleSubmit } = props
  return <form onSubmit={handleSubmit}>{/* form body*/}</form>
}

ContactForm = reduxForm({
  // a unique name for the form
  form: 'contact'
})(ContactForm)

export default ContactForm

您正在使用 form 标签,react-native 无法呈现它,所以请改用 View 标签。您将必须创建按钮并在该按钮上使用 onClick={handleSubmit}。