Skip to content

Commit

Permalink
Use React's New Context API (#198)
Browse files Browse the repository at this point in the history
* first draw

* working solution

* remove childContextTypes

* tests passing :)

* make eslint? work

* build

* fix merge

* Update src/FormsyContext.ts

Co-Authored-By: Robert Kuykendall <robert@rkuykendall.com>

* Update src/index.ts

Co-Authored-By: Robert Kuykendall <robert@rkuykendall.com>

* CR rkuykendall

* don't commit build files

* Update src/index.ts

Co-Authored-By: Robert Kuykendall <robert@rkuykendall.com>
  • Loading branch information
ThibautMarechal and rkuykendall committed Feb 15, 2020
1 parent 6fcc682 commit a79eec2
Show file tree
Hide file tree
Showing 10 changed files with 574 additions and 535 deletions.
100 changes: 50 additions & 50 deletions dist/Wrapper.d.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import React from 'react';
import PropTypes from 'prop-types';
import { RequiredValidation, Validations } from './interfaces';
declare const propTypes: {
innerRef: PropTypes.Requireable<(...args: any[]) => any>;
name: PropTypes.Validator<string>;
required: PropTypes.Requireable<string | boolean | object>;
validations: PropTypes.Requireable<string | object>;
value: PropTypes.Requireable<any>;
};
export interface WrapperProps<V> {
innerRef?: (ref: any) => void;
name: string;
required?: RequiredValidation<V>;
validationError?: any;
validationErrors?: any;
validations?: Validations<V>;
value?: V;
}
export interface WrapperState<V> {
[key: string]: unknown;
externalError: null;
formSubmitted: boolean;
isPristine: boolean;
isRequired: boolean;
isValid: boolean;
pristineValue: any;
validationError: any[];
value: V;
}
export interface InjectedProps<V> {
errorMessage: any;
errorMessages: any;
hasValue: boolean;
isFormDisabled: boolean;
isFormSubmitted: boolean;
isPristine: boolean;
isRequired: boolean;
isValid: boolean;
isValidValue: (value: V) => boolean;
ref?: any;
resetValue: any;
setValidations: any;
setValue: (value: V) => void;
showError: boolean;
showRequired: boolean;
}
export declare type PassDownProps<V> = WrapperProps<V> & InjectedProps<V>;
export { propTypes };
export default function <T, V>(WrappedComponent: React.ComponentType<T & PassDownProps<V>>): React.ComponentType<Omit<T & WrapperProps<V>, keyof InjectedProps<V>>>;
import React from 'react';
import PropTypes from 'prop-types';
import { RequiredValidation, Validations } from './interfaces';
declare const propTypes: {
innerRef: PropTypes.Requireable<(...args: any[]) => any>;
name: PropTypes.Validator<string>;
required: PropTypes.Requireable<string | boolean | object>;
validations: PropTypes.Requireable<string | object>;
value: PropTypes.Requireable<any>;
};
export interface WrapperProps<V> {
innerRef?: (ref: any) => void;
name: string;
required?: RequiredValidation<V>;
validationError?: any;
validationErrors?: any;
validations?: Validations<V>;
value?: V;
}
export interface WrapperState<V> {
[key: string]: unknown;
externalError: null;
formSubmitted: boolean;
isPristine: boolean;
isRequired: boolean;
isValid: boolean;
pristineValue: any;
validationError: any[];
value: V;
}
export interface InjectedProps<V> {
errorMessage: any;
errorMessages: any;
hasValue: boolean;
isFormDisabled: boolean;
isFormSubmitted: boolean;
isPristine: boolean;
isRequired: boolean;
isValid: boolean;
isValidValue: (value: V) => boolean;
ref?: any;
resetValue: any;
setValidations: any;
setValue: (value: V) => void;
showError: boolean;
showRequired: boolean;
}
export declare type PassDownProps<V> = WrapperProps<V> & InjectedProps<V>;
export { propTypes };
export default function <T, V>(WrappedComponent: React.ComponentType<T & PassDownProps<V>>): React.ComponentType<Omit<T & WrapperProps<V>, keyof InjectedProps<V>>>;
Loading

0 comments on commit a79eec2

Please sign in to comment.