vtex-apps/admin-pages

Widget options don't work for nested arrays

hapoza opened this issue · 1 comments

Expected Behavior

Widget options should works anywhere, just like it does with react-json-schema-form

Current Behavior

Widget options are only rendered for the properties of the root schema object. Nested properties and/or arrays with widget options don't work.

Possible Solution

N/A

Steps to Reproduce (for bugs)

  1. Create a schema with a nested object or array (inside any property of the root object), having a "ui:widget" configuration

Context

Need image inside nested arrays. In this screenshot, both "Image" fields that show up are the exact same definition, but only the one closer to the root gets rendered according to its configuration, "ui:widget": "image-uploader".
screenshot at nov 29 12-41-02

Your Environment

  • Version used: v2.3.9
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Version 70.0.3538.110 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): macOS High Sierra
  • Link to your project:
alcar commented

Hey, @hapoza! Sorry for the late reply.

Please make sure that you're declaring a public, static uiSchema attribute. Here's an example from the Carousel component:

public static uiSchema = {
  banners: {
    items: {
      image: {
        'ui:widget': 'image-uploader',
      },
      mobileImage: {
        'ui:widget': 'image-uploader',
      },
    },
  },
}