From bfc7bae3bc21f60b4b486559df353b4eb44cef5b Mon Sep 17 00:00:00 2001 From: Pathik Gandhi Date: Wed, 13 Mar 2019 23:47:12 +0530 Subject: [PATCH 1/3] #804 - Bug Fix - Empty divs are created --- src/components/fields/ArrayField.js | 4 ++-- src/components/fields/DescriptionField.js | 3 +-- src/components/fields/SchemaField.js | 12 ++++-------- test/ArrayFieldTemplate_test.js | 13 ++++++++++--- test/SchemaField_test.js | 2 +- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/components/fields/ArrayField.js b/src/components/fields/ArrayField.js index f60e5b86ff..c769ddd8fa 100644 --- a/src/components/fields/ArrayField.js +++ b/src/components/fields/ArrayField.js @@ -22,7 +22,7 @@ import { function ArrayFieldTitle({ TitleField, idSchema, title, required }) { if (!title) { // See #312: Ensure compatibility with old versions of React. - return
; + return null; } const id = `${idSchema.$id}__title`; return ; @@ -31,7 +31,7 @@ function ArrayFieldTitle({ TitleField, idSchema, title, required }) { function ArrayFieldDescription({ DescriptionField, idSchema, description }) { if (!description) { // See #312: Ensure compatibility with old versions of React. - return
; + return null; } const id = `${idSchema.$id}__description`; return ; diff --git a/src/components/fields/DescriptionField.js b/src/components/fields/DescriptionField.js index b1ac9a2362..25ed1c79c7 100644 --- a/src/components/fields/DescriptionField.js +++ b/src/components/fields/DescriptionField.js @@ -4,8 +4,7 @@ import PropTypes from "prop-types"; function DescriptionField(props) { const { id, description } = props; if (!description) { - // See #312: Ensure compatibility with old versions of React. - return
; + return null; } if (typeof description === "string") { return ( diff --git a/src/components/fields/SchemaField.js b/src/components/fields/SchemaField.js index bf60a3e412..a48523d866 100644 --- a/src/components/fields/SchemaField.js +++ b/src/components/fields/SchemaField.js @@ -61,8 +61,7 @@ function getFieldComponent(schema, uiSchema, idSchema, fields) { function Label(props) { const { label, required, id } = props; if (!label) { - // See #312: Ensure compatibility with old versions of React. - return
; + return null; } return (