DigitalRiver / react-atlas

Composable React components with CSS Modules.
http://digitalriver.github.io/react-atlas/
MIT License
38 stars 25 forks source link

bug in <Form>'s _addRefs function #956

Closed floydchenchen closed 6 years ago

floydchenchen commented 6 years ago

to reproduce:

when there is only one child inside <Form>, an error will come up in the console

        <Form action="/" onSubmit={(submitObject) => {console.log(submitObject)}}>
          <div className="ONLY-CHILD">
            <div style={{ width: "250px", paddingRight: "10px", display: "inline-block"}}>
              <TextField name="firstName" style={{width: "200px"}} label="First Name: " required/>
              <TextField name="lastName" style={{width: "200px"}} label="Last Name: " required/>
            </div>
            <Button primary type="submit">Submit</Button>
          </div>
        </Form>

image

having at least two children will solve this issue

        <Form action="/" onSubmit={(submitObject) => {console.log(submitObject)}}>
          <div className="FIRST-CHILD">
            <div style={{ width: "250px", paddingRight: "10px", display: "inline-block"}}>
              <TextField name="firstName" style={{width: "200px"}} label="First Name: " required/>
              <TextField name="lastName" style={{width: "200px"}} label="Last Name: " required/>
            </div>
            <Button primary type="submit">Submit</Button>
          </div>
          <div className="SECOND-CHILD"></div>
        </Form>

image

Darper commented 6 years ago

This has been fixed in the Form PR #953. Thanks for testing.