rjsf-team/react-jsonschema-form

Nested dependency doesn't update

Open

#3,894 创建于 2023年10月5日

在 GitHub 查看
 (7 评论) (0 反应) (0 负责人)TypeScript (13,175 star) (2,136 fork)batch import
featurehelp wanted

描述

Prerequisites

What theme are you using?

core

What is your question?

I have a react JSON schema like this

{ "type": "object", "properties": { "platform": { "title": "", "$ref": "#/definitions/platform" } }, "definitions": { "username": { "type": "string", "title": "Enter Username" }, "url": { "type": "string", "title": "Enter url" }, "lineId": { "type": "string", "title": "Enter LineID" }, "platform": { "type": "object", "properties": { "platform": { "type": "string", "title": "Select Platform", "enum": [ "--select--", "Facebook", "Instagram", "Line" ], "default": "--select--" } }, "dependencies": { "action": { "oneOf": [ { "properties": { "action": { "const": "Follow" }, "username": { "$ref": "#/definitions/username" } } }, { "properties": { "action": { "const": "Share" }, "url": { "$ref": "#/definitions/url" } } }, { "properties": { "action": { "const": "Add" }, "lineId": { "$ref": "#/definitions/lineId" } } } ] }, "platform": { "oneOf": [ { "properties": { "platform": { "enum": [ "Facebook" ] }, "action": { "type": "string", "title": "Select Action", "enum": [ "Follow", "Share" ], "enumNames": [ "Follow", "Share" ] } } }, { "properties": { "platform": { "enum": [ "Instagram" ] }, "action": { "type": "string", "title": "Select Action", "enum": [ "Follow" ], "enumNames": [ "Follow" ] } } }, { "properties": { "platform": { "enum": [ "Line" ] }, "action": { "type": "string", "title": "Select Action", "enum": [ "Add" ], "enumNames": [ "Add" ] } } } ] } } } } }

on selecting platform an action field is rendered and based on the action field i am rendering different text fields. After Selecting a platform and action the third text field is displayed, However when i change the platform again the text field is still rendered on the screen .

Is it possible to hide the third field when i re select the platform ?

贡献者指南