-
Notifications
You must be signed in to change notification settings - Fork 3.5k
17018 — migrate CheckboxWithLabel to the PressableWithFeeback component #18792
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
17018 — migrate CheckboxWithLabel to the PressableWithFeeback component #18792
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
|
@Santhosh-Sellavel @marcaaron One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address this
|
I wasn't sure on which device you were testing but after changes I've checked it on web inside resonsive design tool: test on responsivnesScreen.Recording.2023-05-15.at.23.30.52.mov |
|
Thanks, @robertKozik this was from the web/desktop. On iOS/Android it is still broken. BeforeNowContent is overflowing outside the padding on the right side. |
|
I saw lint is not failing, I'll handle it asap |
Reviewer Checklist
Screenshots/VideosWeb & DesktopScreen.Recording.2023-05-17.at.11.45.55.PM.movMobile Web - ChromeScreen_Recording_20230518_000723_Chrome.mp4Mobile Web - Safari & iOSSimulator.Screen.Recording.-.iPhone.14.-.2023-05-18.at.00.08.54.mp4AndroidScreen_Recording_20230518_001843_New.Expensify.mp4 |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and tests well.
It is not working on the storybook. Seems it's not been updated for a while. What should we do here @marcaaron
|
I checked the storybook problem, and it's easily solvable, so I'll include it in a sec |
|
Still Screen.Recording.2023-05-19.at.1.43.07.AM.movcc: @marcaaron |
|
CheckboxWithLabel due to some previous updates self manages its state. Passed |
|
@marcaaron What should we do here? |
roryabraham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please:
- Migrate
CheckboxWithLabelto a function component. - Update
isCheckedstate when the passed-inisCheckedprop changes:
useEffect(() => setIsChecked(props.isChecked), [props.isChecked]);|
Sure no problem, I'll do it today. |
|
All requested changes are implemented, but when starting storybook I've encountered an error as I check its related with choosing the splashLogo inside Regardless, after coping with that problem CheckboxWithLabel is working fine in the storybook. |
|
@robertKozik Conflicts here, please resolve when you get a chance! I'll get through the checklist tomorrow! |
This occurs to me, please report it. And yes |
Santhosh-Sellavel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM tests well!
|
All your @roryabraham! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.3.22-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.22-1 🚀
|
2 similar comments
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.22-1 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.22-1 🚀
|
| /> | ||
| <PressableWithFeedback | ||
| focusable={false} | ||
| accessible={false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from #20153:
accessible={false}
@robertKozik Is this intentional or temporary solution to fix console error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's intentional, we have checkbox accessible and focusable itself. I wanted to remove two accessible views one next to another, which are doing the same
| const CheckboxWithLabel = (props) => { | ||
| // We need to pick the first value that is strictly a boolean | ||
| // https://github.com/Expensify/App/issues/16885#issuecomment-1520846065 | ||
| const [isChecked, setIsChecked] = useState(_.find([props.value, props.defaultValue, props.isChecked], (value) => _.isBoolean(value))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to check the case when the checkbox is controlled or uncontrolled.
More details here:




Details
This PR migrates the soon-to-be deprecated
TouchableOpacityto thePressableWithFeedbackcomponent. Changes theAccessibilityLabelof BaseGenericPressable to be required only when component is set to be accessible.Fixed Issues
$ #17018
PROPOSAL: #17018
Tests
Make sure that every instance of
CheckboxWithLabelis working correctly (fe. enablePaymentPage when adding debit card as new payment method)CheckboxWithLabelOffline tests
SAME AS TEST STEPS
QA Steps
SAME AS TEST STEPS
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Desktop.-.web.mov
Mobile Web - Chrome
Android.-.chrome.mov
Mobile Web - Safari
iOS.-.safari.mov
Desktop
Desktop.-.electron.mov
iOS
iOS.-.native.mov
Android
Android.-.native.mov