amplify-studio
amplify-studio copied to clipboard
UI Library: Duplicated onChange() of switch field
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
App Id
XXX
Region
ap-southeast-2
Environment name
staging
Figma File Version (if applicable)
No response
Amplify CLI Version
12.3.0
If applicable, what version of Node.js are you using?
No response
What operating system are you using?
Mac
Browser type?
Chrome
Describe the bug
Use UI Library to add an onChange
prop for a switch field. The generated code has duplicated onChange
.
Expected behavior
Generate only one onChange
, combine the new onChange
with the default onChange
.
Reproduction steps
- Create a Figma component with Switch filed component.
- Configure the component in UI Library.
- Add a
onChange
prop. - Amplify pull.
- Check the code.
<SwitchField
width="201px"
height="unset"
justifyContent="flex-start"
position="absolute"
top="0px"
left="0px"
label="Is completed"
size="default"
isDisabled={false}
labelPosition="start"
isChecked={switchFieldIsChecked}
onChange={() => {
switchFieldOnChange();
}}
onChange={() => setSwitchFieldIsChecked(!switchFieldIsChecked)}
{...getOverrideProps(overrides, "SwitchField")}
></SwitchField>
Project Identifier
No response
Additional information
No response
Hey @lwang-79, thank you for reaching out. I was able to reproduce the issue, marking this as bug.