Git Product home page Git Product logo

react-jsonschema-form-validation's People

Contributors

hugomallet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

minaairsupport

react-jsonschema-form-validation's Issues

Not getting useFormContext()

Hi!!

I can get the context:

import { Form, useFormContext } from 'react-jsonschema-form-validation';
const context = useFormContext()

context is always

undefined

Any idea? I wonder if there is something related with webpack and default exports.

Missing arguments in onChange handler

memoGetOnChangeHandler = memoize((onChange, handleFieldChange) => (event) => {
		if (onChange) {
			// Pass Form.handleFieldChange handler as extra parameter to the onChange handler
			onChange(event, handleFieldChange);
			return;
		}

		handleFieldChange(event);
	})

this is onChange handler from Field.js. It passes further only first argument 'event' from component, but e.g. react-select passes the second param https://react-select.com/props.

Dynamically disabling/enabling button based on form data validity.

I am trying to wire the submit button the the Form component's valid state. In other words, the goal is to keep the button disabled until the form satisfies all validity constraints.

My current implementation is based on React references and, as expected, works unsatisfactorily due to the asynchronous nature of the process. There is no guarantee that the valid state of the Form component is updated by the time setState is run in the parent component:

this.FormRef = React.createRef(null);

handleChange = (data) => {
     this.setState({
        formData: data,
        success: false,
        invalid: !this.FormRef.current.state.valid
    })
}
...
<Form
   ref={this.FormRef}
   
>

</Form>

ReactJS is still somewhat out of my depth, but I wonder whether the Form component could be tweaked to expose its valid state more reliably and painlessly—for instance by passing valid as a prop to the onChange callback, or including it in form data, or by not triggering the onChange handler until the state has been updated.

Thanks for your help and for a fantastic library.

Can't debug outside create-react-app

The debug flag is prefixed with REACT_APP_... so it is adapted to cra but not for other build tools such as gatsby which requires env variables to be prefixed with GATSBY_ to be available client-side.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.