MCPcopy Index your code
hub / github.com/adobe/react-spectrum / getValidity

Function getValidity

packages/react-aria/src/form/useFormValidation.ts:134–151  ·  view source on GitHub ↗
(input: ValidatableElement)

Source from the content-addressed store, hash-verified

132}
133
134function getValidity(input: ValidatableElement) {
135 // The native ValidityState object is live, meaning each property is a getter that returns the current state.
136 // We need to create a snapshot of the validity state at the time this function is called to avoid unpredictable React renders.
137 let validity = input.validity;
138 return {
139 badInput: validity.badInput,
140 customError: validity.customError,
141 patternMismatch: validity.patternMismatch,
142 rangeOverflow: validity.rangeOverflow,
143 rangeUnderflow: validity.rangeUnderflow,
144 stepMismatch: validity.stepMismatch,
145 tooLong: validity.tooLong,
146 tooShort: validity.tooShort,
147 typeMismatch: validity.typeMismatch,
148 valueMissing: validity.valueMissing,
149 valid: validity.valid
150 };
151}
152
153function getNativeValidity(input: ValidatableElement): ValidationResult {
154 return {

Callers 1

getNativeValidityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected