-
Notifications
You must be signed in to change notification settings - Fork 3k
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: SelectionListRadio #21048
refactor: SelectionListRadio #21048
Conversation
You can see the warning here, follow what I do in the recording. Also, I see this bug still occurs. You can find that also in the video attached below when the keyboard is active, thanks!
Screen.Recording.2023-07-05.at.12.18.31.AM.mov |
@Santhosh-Sellavel Sorry for the inconvenience. I wasn't indeed able to see it yesterday but I can today 🤷🏻 That said, this warning is not caused by my implementation. It seems to come from For reference, the warning in the 2FA page, that also uses |
Regarding the blank area on top of the keyboard, it was being caused by a safe area and that was not listening to the keyboard change. Should be good now :) |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-07-06.at.1.40.25.AM.movMobile Web - ChromeScreen.Recording.2023-07-06.at.1.35.37.AM.movMobile Web - SafariScreen.Recording.2023-07-06.at.1.32.15.AM.movDesktopScreen.Recording.2023-07-06.at.1.39.09.AM.moviOSScreen.Recording.2023-07-06.at.1.33.51.AM.movAndroidScreen.Recording.2023-07-06.at.1.36.57.AM.mov |
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, all yours @cristipaval!
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.
Great work! 🚀
Thank you for adding it to Storybook and for adding tests! ❤️
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@cristipaval Assign me issue for tracking, thanks! |
done |
🚀 Deployed to staging by https://github.com/cristipaval in version: 1.3.38-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.38-7 🚀
|
maxToRenderPerBatch={5} | ||
windowSize={5} | ||
viewabilityConfig={{viewAreaCoveragePercentThreshold: 95}} | ||
onLayout={() => scrollToIndex(focusedIndex, 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.
This line caused a regression in #22689, On mweb, whenever the keyboard is shown, it triggers a layout change which in turn causes the list to scroll back to the focused index.
I really like this refactor, it makes a lot of sense. What's the short and long term plan for the |
Thanks @cubuspl42! Yeah, the plan is to remove all usages of You can get a short overview in this comment: |
{Boolean(props.headerMessage) && ( | ||
<View style={[styles.ph5, styles.pb5]}> | ||
<Text style={[styles.textLabel, styles.colorMuted]}>{props.headerMessage}</Text> | ||
</View> | ||
)} |
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 block leads to this bug. We still intended to keep consistent spacing for headerMessage
as it was in the other list.
import * as DeviceCapabilities from '../../libs/DeviceCapabilities'; | ||
|
||
const SelectionListRadio = forwardRef((props, ref) => { | ||
const [isScreenTouched, setIsScreenTouched] = useState(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.
Small performance improvement, this could be rewritten to useRef
, as isScreenTouched
is not used on UI so we don't need to re-render.
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.
@ArekChr Cool, I agree! It's like this because it was just copied from the old implementation. ccing @lukemorawski as he will be continuing with the refactor
Details
Phase 1 of 3, regarding selection lists refactor. Tracker issue: #11795
This PR creates a new clean component (
SelectionListRadio
) for lists with single selection, and replaces usages ofOptionsSelector
andOptionsList
with this new component in the following pages:TimezoneSelectPage
PronounsPage
YearPickerPage
PriorityModePage
LanguagePage
Most of the code was transported from the old components and simplified to the new one. All the previous features are maintained.
Previously there were 5 levels of hierarchy:
OptionsSelector
->BaseOptionsSelector
->OptionsList
->BaseOptionsList
->OptionRow
And now there is 2:
SelectionListRadio
->BaseSelectionListRadio
, which greatly simplifies usage and understanding.Also, there was a lot of props removed regarding customisation of the lists appearance, which were often small paddings. These props were removed, further simplifying the component logic and standardising the look and feel across all single selection lists.
Finally, storybook stories were created for the variations, as well as performance tests.
Fixed Issues
$ #20352
PROPOSAL: #11795 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web - Chrome
web.chrome.mov
Web - Safari
web.safari.mov
Mobile Web - Chrome
android.web.mov
Mobile Web - Safari
ios.web.mp4
Desktop
desktop.mov
iOS
ios.native.mp4
Android
android.native.mov