diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d5294721..ef293fdbb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ should change the heading of the (upcoming) version to include a major version b - Implemented programmatic validation via new `validateForm()` method on `Form`, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/2755, https://github.com/rjsf-team/react-jsonschema-form/issues/2552, https://github.com/rjsf-team/react-jsonschema-form/issues/2381, https://github.com/rjsf-team/react-jsonschema-form/issues/2343, https://github.com/rjsf-team/react-jsonschema-form/issues/1006, https://github.com/rjsf-team/react-jsonschema-form/issues/246) - Renamed `WithThemeProps` to `ThemeProps` to prevent another breaking-change by returning the type back to the name it had in version 4 - Pass `uiSchema` appropriately to all of the `IconButton`s, `ArrayFieldItemTemplate` and `WrapIfAdditional` components, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/3130) +- Updated `ArrayField` to fall back to `SchemaField` if `ArraySchemaField` is not defined, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/3131) ## @rjsf/fluent-ui - Updated `Theme` to use the renamed `ThemeProps` from `@rjsf/core` @@ -62,6 +63,7 @@ should change the heading of the (upcoming) version to include a major version b - Fixed the `chakra-ui` custom `uiSchema` documentation to make it clear they work on a per-field basis, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/2865) - Added `formElement` breaking-change documentation to the `5.x upgrade guide.md` - Replace Webpack with Vite +- Updated documentation for `ArraySchemaField` to better represent the updated implementation, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/3131) # 5.0.0-beta.8 diff --git a/docs/advanced-customization/custom-widgets-fields.md b/docs/advanced-customization/custom-widgets-fields.md index 6dbaccfe97..227da21fff 100644 --- a/docs/advanced-customization/custom-widgets-fields.md +++ b/docs/advanced-customization/custom-widgets-fields.md @@ -356,8 +356,8 @@ Props passed to a custom SchemaField are the same as [the ones passed to a custo ### Custom ArraySchemaField Everything that was mentioned above for a `Custom SchemaField` applies, but this is only used to render the Array item `children` that are then passed to the `ArrayFieldItemTemplate`. -By default, `ArraySchemaField` uses the main `SchemaField` implementation. -If you want to customize how the individual items for an array are rendered, override the `ArraySchemaField`. +By default, `ArraySchemaField` is not actually provided as `ArrayField` implementation fallsback to the `SchemaField` implementation. +If you want to customize how the individual items for an array are rendered, provide your implementation of `ArraySchemaField` as a `fields` override. ```jsx import validator from '@rjsf/validator-ajv6'; diff --git a/packages/core/src/components/fields/ArrayField.tsx b/packages/core/src/components/fields/ArrayField.tsx index 14bd27ed8d..1014044f62 100644 --- a/packages/core/src/components/fields/ArrayField.tsx +++ b/packages/core/src/components/fields/ArrayField.tsx @@ -805,8 +805,9 @@ class ArrayField extends Component< formContext, } = this.props; const { - fields: { ArraySchemaField }, + fields: { ArraySchemaField, SchemaField }, } = registry; + const ItemSchemaField = ArraySchemaField || SchemaField; const { orderable = true, removable = true } = getUiOptions( uiSchema ); @@ -820,7 +821,7 @@ class ArrayField extends Component< return { children: ( -