From 3cc4ec8bc51f7963a8312ddb2bb8df46f883f427 Mon Sep 17 00:00:00 2001 From: amitbadala Date: Thu, 26 Oct 2023 14:50:16 +0530 Subject: [PATCH] Update based on the new onChange func --- examples/for-tests/src/App.js | 20 ++++++------------- lib/build/passwordless-shared3.js | 10 ++-------- .../themes/signInUp/phoneNumberInput.tsx | 10 ++-------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index e7d7adf4c..f888f4bac 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -172,12 +172,8 @@ const customFields = [ { id: "ratings", label: "Ratings", - inputComponent: ({ value, name, ...rest }) => ( - onChange(e.target.value)} placeholder="Add Ratings"> @@ -190,25 +186,21 @@ const customFields = [ }, { id: "terms", - showLabels: false, + label: "", optional: false, - inputComponent: ({ value, name, ...rest }) => ( + inputComponent: ({ name, onChange }) => (
- rest.onChange({ id: name, value: e.target.checked })}> + onChange(e.target.checked.toString())}> I agree to the terms and conditions
), validate: async (value) => { - if (value === true) { + if (value === "true") { return undefined; } return "Please check Terms and conditions"; diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 54b23e5a7..926983c06 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -2596,10 +2596,7 @@ function PhoneNumberInput(_a) { var handleChange = React.useCallback( function (newValue) { if (onChangeRef.current !== undefined) { - onChangeRef.current({ - id: name, - value: newValue, - }); + onChangeRef.current(newValue); } }, [onChangeRef] @@ -2607,10 +2604,7 @@ function PhoneNumberInput(_a) { var handleCountryChange = React.useCallback( function (ev) { if (onChangeRef.current !== undefined && phoneInputInstance !== undefined) { - onChangeRef.current({ - id: name, - value: ev.target.value, - }); + onChangeRef.current(ev.target.value); } }, [onChangeRef] diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneNumberInput.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneNumberInput.tsx index 584c230dd..79f7eb314 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneNumberInput.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneNumberInput.tsx @@ -71,10 +71,7 @@ function PhoneNumberInput({ const handleChange = useCallback( (newValue: string) => { if (onChangeRef.current !== undefined) { - onChangeRef.current({ - id: name, - value: newValue, - }); + onChangeRef.current(newValue); } }, [onChangeRef] @@ -83,10 +80,7 @@ function PhoneNumberInput({ const handleCountryChange = useCallback( (ev) => { if (onChangeRef.current !== undefined && phoneInputInstance !== undefined) { - onChangeRef.current({ - id: name, - value: ev.target.value, - }); + onChangeRef.current(ev.target.value); } }, [onChangeRef]