-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refactor picker to be a cross-platform component #2242
Conversation
src/components/Checkbox.js
Outdated
<Pressable onPress={() => onClick(!isChecked)}> | ||
{label ? ( |
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.
are we hiding the checkbox from now on if there's a label present? I think we should show the Checkmark icon regardless, otherwise, it's hard to know that it's a clickable element
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.
Ah, good catch. I think I read the original code wrong. I need to revert this.
actionName: PropTypes.string.isRequired, | ||
actionName: PropTypes.string, |
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.
why the switch to making these prop optional?
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.
There was a prop warning in the console that undefined
was being passed. I looked through the code and there is a spot where the report action passed is {}
(an empty object) so I just corrected the propTypes here.
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.
Updated!
src/components/Checkbox.js
Outdated
<Pressable onPress={() => onClick(!isChecked)}> | ||
{label ? ( |
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.
Ah, good catch. I think I read the original code wrong. I need to revert this.
actionName: PropTypes.string.isRequired, | ||
actionName: PropTypes.string, |
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.
There was a prop warning in the console that undefined
was being passed. I looked through the code and there is a spot where the report action passed is {}
(an empty object) so I just corrected the propTypes here.
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 and test well on Web and iOS
looks like there are some merge conflicts too @tgolen |
OK, updated to fix the conflicts. I added a file rename so that we are using the proper conventions and pointed out some more missing method docs and comments in #2169 |
inputAndroid: [ | ||
styles.picker.inputAndroid, styles.textInput, styles.disabledTextInput, | ||
], |
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.
not sure how platform specific styles are handled but would it make more sense to have the ios/android/index files just export the style and the component itself be defined once? would avoid duplication and make it easier to update without having to touch 3 files
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.
Two small comments, looking good otherwise.
@@ -0,0 +1,35 @@ | |||
import React from 'react'; |
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.
I'm not sure I understand why we need three different, largely identical files for the picker.
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.
is the style the only change? could we have that an input for another compnent perharphs? No real idea, just wandering
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.
Yeah, the styles are basically the only difference. I like the idea of just exporting the proper styles from the platform-specific files and DRYing this up more. I'll be working on that today.
items={items} | ||
style={useDisabledStyles ? { | ||
...styles.picker, | ||
inputAndroid: [ |
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.
This can be
inputAndroid: [styles.picker.inputAndroid, styles.textInput, styles.disabledTextInput],
OK, updated and retested on all platforms. I refactored it so the component is only defined once and only the styles are platform specific. |
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.
This looks good to me, any reason that mWeb is marked as n/a?
Just because... laziness 😁 I added testing for mobile web. |
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
We are blocked to check this QA this PR in both iOS and Android apps because of the scrolling issue in settings>profile #2147 |
QA in other platforms was a pass (mweb, web, desktop) |
@nickmurray47 @NikkiWines This PR was based on some stuff that I came across in #1767, primarily some missing method docs. As I looked more at the PR, I spotted a few things that should be improved to match our existing patterns better. Please have a look at this and let me know if you have any questions
Details
Fixed Issues
No issue, just some things I spotted in #1767
Tests / QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android