Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formContext is undefined when using a custom schemaField #2394

Closed
2 of 3 tasks
snowbambo opened this issue May 25, 2021 · 1 comment
Closed
2 of 3 tasks

formContext is undefined when using a custom schemaField #2394

snowbambo opened this issue May 25, 2021 · 1 comment
Assignees
Labels

Comments

@snowbambo
Copy link

snowbambo commented May 25, 2021

Prerequisites

Description

First of all sorry if this is not the correct way of posting, I am not used to that so please tell me if I do anything wrong.

So I'm trying to use a custom SchemaField and according to the documentation I'm supposed to be able to use the same props as the one in a custom field. But while I am able to retrieve the formContext property on all of my custom code (custom widget and custom object field template), it is always undefined when I try to use it in the custom SchemaField.

Steps to Reproduce

  1. create a custom SchemaField
  2. create a formContext with some property
  3. provide the custom schemaField and the formContext to the form

Expected behavior

formContext should not be undefined in the custom schemaField

Actual behavior

formContext is undefined

Version

rjsf/core: 2.4.1

const CustomSchemaField = (props: any) => {

	const { onChange, name, formContext } = props;

	//here the formContext is undefined
	console.log(formContext)

	return (
		<SchemaField {...props} />
	)
}
@heath-freenome
Copy link
Member

heath-freenome commented Aug 28, 2022

Fixed in v5 beta via #3040, see the 5.x migration guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants