-
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
Migrate DatePicker/index.android.js to function component #16136 #25657
Migrate DatePicker/index.android.js to function component #16136 #25657
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
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
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.
Reviewed. Agree with other comments. Also, please add displayName
.
…omp-to-functional
<RNDatePicker | ||
value={value || defaultValue ? moment(value || defaultValue).toDate() : new Date()} | ||
mode="date" | ||
onChange={() => setDate()} |
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.
Did you test android app after your last commit? setDate
requires 2 params.
Please add screenshot, at least for android.
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.
Oh, so sorry about that :/
Just fixed it and attached a evidence for Android
errorText={errorText} | ||
containerStyles={containerStyles} | ||
textInputContainerStyles={isPickerVisible ? [styles.borderColorFocus] : []} | ||
onPress={() => showPicker()} |
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 works for arrow functions. Maybe you had used function
keyword before.
onPress={() => showPicker()} | |
onPress={showPicker} |
editable={false} | ||
disabled={disabled} | ||
onBlur={onBlur} | ||
ref={(element) => setRef(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.
Same here:
ref={(element) => setRef(element)} | |
ref={setRef} |
<RNDatePicker | ||
value={value || defaultValue ? moment(value || defaultValue).toDate() : new Date()} | ||
mode="date" | ||
onChange={() => setDate()} |
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.
onChange={() => setDate()} | |
onChange={setDate} |
import {Keyboard} from 'react-native'; | ||
import RNDatePicker from '@react-native-community/datetimepicker'; | ||
import moment from 'moment'; | ||
import _ from 'underscore'; | ||
import isFunction from 'lodash/isFunction'; |
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.
Any reason for replacing underscore with lodash?
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 was suggested by a review from our team, but I just reverted it back to underscore
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.
@situchan, AFAIK, there is a reason - #27459 (comment).
cc @arthurmfgtab
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 problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. But we haven't ever used lodash/isFunction
pattern in our app. Just don't wanna be the first introducer.
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.
Got it. It is up to you guys, I just remember my conversation about it.
There's unverified commit |
@situchan after having a couple of issues with conflicts while trying to sign an old commit I decided to created another PR and ditch this one, here's the one I also fixed my git config so now every commit will be properly signed automatically, that way I won't have this signing issues again. |
Details
Fixed Issues
$ #16136
PROPOSAL: N/A
Tests
Offline tests
Not applicable.
QA Steps
Not applicable.
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
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android
Screen.Recording.2023-09-21.at.02.55.18.mov