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

[docs] Fix masked text field bug #20397

Merged
merged 3 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/src/pages/components/text-fields/FormattedInputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function NumberFormatCustom(props) {
onValueChange={(values) => {
onChange({
target: {
name: props.name,
value: values.value,
},
});
Expand All @@ -59,6 +60,7 @@ function NumberFormatCustom(props) {

NumberFormatCustom.propTypes = {
inputRef: PropTypes.func.isRequired,
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
};

Expand All @@ -83,7 +85,7 @@ export default function FormattedInputs() {
<Input
value={values.textmask}
onChange={handleChange}
name="formatted-text-mask-input"
name="textmask"
id="formatted-text-mask-input"
inputComponent={TextMaskCustom}
/>
Expand All @@ -92,7 +94,7 @@ export default function FormattedInputs() {
label="react-number-format"
value={values.numberformat}
onChange={handleChange}
name="formatted-numberformat-input"
name="numberformat"
id="formatted-numberformat-input"
InputProps={{
inputComponent: NumberFormatCustom,
Expand Down
8 changes: 5 additions & 3 deletions docs/src/pages/components/text-fields/FormattedInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function TextMaskCustom(props: TextMaskCustomProps) {

interface NumberFormatCustomProps {
inputRef: (instance: NumberFormat | null) => void;
onChange: (event: { target: { value: string } }) => void;
onChange: (event: { target: { name: string; value: string } }) => void;
name: string;
}

function NumberFormatCustom(props: NumberFormatCustomProps) {
Expand All @@ -52,6 +53,7 @@ function NumberFormatCustom(props: NumberFormatCustomProps) {
onValueChange={(values) => {
onChange({
target: {
name: props.name,
value: values.value,
},
});
Expand Down Expand Up @@ -89,7 +91,7 @@ export default function FormattedInputs() {
<Input
value={values.textmask}
onChange={handleChange}
name="formatted-text-mask-input"
name="textmask"
id="formatted-text-mask-input"
inputComponent={TextMaskCustom as any}
/>
Expand All @@ -98,7 +100,7 @@ export default function FormattedInputs() {
label="react-number-format"
value={values.numberformat}
onChange={handleChange}
name="formatted-numberformat-input"
name="numberformat"
id="formatted-numberformat-input"
InputProps={{
inputComponent: NumberFormatCustom as any,
Expand Down