[TS migration] Migrate 'Picker' and 'LocalePicker' components to TypeScript#30646
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
# Conflicts: # src/components/Picker/BasePicker.js
# Conflicts: # src/components/LocalePicker.js
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [items]); | ||
|
|
||
| const context = useContext(ScrollContext); |
There was a problem hiding this comment.
I think it would be good to move it to ScrollContext file and extract it to seperate function lik
| const context = useContext(ScrollContext); | |
| const useScrollContext = () => useContext(ScrollContext); |
so then we only need to import useScrollContext here
There was a problem hiding this comment.
@kubabutkiewicz Maybe we should create a separate custom hook then? Cause I have found only two approaches in the codebase:
- using context as in the current version (another example is PopoverContext usage)
- separate custom hook - useLocalize for example
There was a problem hiding this comment.
Separate custom hook is what I was suggesting here, so I would go with similar approach as useLocalize 😄
|
|
||
| if (isDisabled) { | ||
| return ( | ||
| <View key={inputID}> |
There was a problem hiding this comment.
Why did you add key={inputID}? afaik inputID is only used internally inside Form logic.
There was a problem hiding this comment.
Initially there was a forwardRef which also added an inputID key to the element.
But during this discussion it was updated.
@fabioh8010 So do you think it makes sense to revert it all (including forwardRef logic)?
There was a problem hiding this comment.
Yeah I think it would be safer to revert it 🤔
|
@aimane-chnaif Please 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] |
# Conflicts: # package-lock.json # package.json # src/components/Picker/BasePicker.js
|
@aimane-chnaif kind bump 🙂 |
| "react-native-performance": "^5.1.0", | ||
| "react-native-permissions": "^3.9.3", | ||
| "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#eae05855286dc699954415cc1d629bfd8e8e47e2", | ||
| "react-native-picker-select": "git+https://github.com/Expensify/react-native-picker-select.git#0d15d4618f58e99c1261921111e68ee85bb3c2a8", |
There was a problem hiding this comment.
Picker needs to be fully tested as this change includes Expensify/react-native-picker-select#14 which has lots of upstream changes
| // but doesn't open the picker (which we don't want), like it does on | ||
| // Native. | ||
| shouldFocusPicker | ||
| key={props.inputID} |
There was a problem hiding this comment.
Any error without this line? This was not existed before
There was a problem hiding this comment.
@aimane-chnaif Initially there was a forwardRef which also added a key with inputID.
App/src/components/Picker/BasePicker.js
Lines 298 to 307 in d2056af
During TS migration forwardRef was refactored to align with other TS files so the key prop was moved from the BasePicker file to the BasePicker usage inside Picker files.
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movandroid2.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.movios2.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25063 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
Regarding snyk tests failure, I think this happens on all PRs which touched package file |
# Conflicts: # src/components/Picker/BasePicker.js
|
As there was conflict, please retest all 3 test cases on platforms to be safe |
|
@aimane-chnaif I've retested only one case on all platforms and will be able to test 2 more tomorrow morning only 🌃. |
deetergp
left a comment
There was a problem hiding this comment.
Looks good and tests well 👍
|
✋ 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/deetergp in version: 1.4.9-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/deetergp in version: 1.4.9-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.9-5 🚀
|

Details
[TS migration] Migrate 'Picker' and 'LocalePicker' components to TypeScript
Fixed Issues
$ #25063
$ #25091
PROPOSAL: N/A
Tests
First test case:
Second test case:
Third test case:
Storybook
Look through Pickers in the storybook and make sure it looks as expected.
Offline tests
QA Steps
The same as the Tests 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 */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
Android: Native
android_locale.mp4
android1.mp4
android2.mp4
Android: mWeb Chrome
android_web3.mp4
android_web2.mp4
android_web1.mp4
iOS: Native
ios1.mp4
ios2.mp4
ios_locale.mp4
iOS: mWeb Safari
ios_web_locale.mp4
ios_web1.mp4
ios_web2.mp4
MacOS: Chrome / Safari
web_locale.mp4
web2.mp4
web1.mp4
MacOS: Desktop
desktop_locale.mp4
desktop2.mp4
desktop1.mp4
Storybook