removed defaultProps and replaced it with a default value where nece…#32133
removed defaultProps and replaced it with a default value where nece…#32133megs-p wants to merge 21 commits intofacebook:mainfrom megs-p:feature/removeDefaultPropsDrawerLayoutAndroid
Conversation
| * ); | ||
| * ``` | ||
| */ | ||
| drawerBackgroundColor: ColorValue, |
There was a problem hiding this comment.
actually we need this in Props i have added it back
There was a problem hiding this comment.
We shouldn't remove this prop as users should still be able to specify a backgroundColor other than the default
There was a problem hiding this comment.
when we keep this as a part of "Props", it throws an error which says -- """element because property drawerBackgroundColor is missing in
props [1] but exists in Props [2]. [prop-missing]""". Any work around for this? @lunaleaps ? I dont get this error when is do a 'yarn test' locally but from the CI windows-test suite.
| { | ||
| width: this.props.drawerWidth, | ||
| backgroundColor: this.props.drawerBackgroundColor, | ||
| backgroundColor: this.props.drawerBackgroundColor || 'white', |
There was a problem hiding this comment.
Why do we do this? why not use drawerBackgroundColor?
There was a problem hiding this comment.
i have removed the const declaration of drawerBackgroundColor above, we can use the || operator at the site of usage, it seems more intuitive.
There was a problem hiding this comment.
I'd actually suggest the alternative as other (unlikely) usages of drawerBackgroundColor might come up and not pass 'white' as a default
There was a problem hiding this comment.
Sure thanks for the suggestion @lunaleaps ! will go with the earlier approach and not use this.props.drawerBackgroundColor
Base commit: 8c25711 |
…rawerBackgroundColor
|
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
Hey @mdaj06, |
|
Hi @cortinico looks like my fork was 80 commits behind, i have now fetched upstream and have merged those commits from main to my branch. This should work i guess please correct me if i am wrong.Thanks! |
|
Some of the CI failures are valid: Can I ask you to take a look at them? Let us know if you get stuck 👍 |
|
@cortinico okay sure will have a look at this and get back to you! |
Base commit: 8c25711 |
…ponent since the native component expects it
…as a default inside render()
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
Outdated
Show resolved
Hide resolved
Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
Outdated
Show resolved
Hide resolved
|
@cortinico I have removed the drawerBackgroundColor from Props as we are giving it a default value later on. Also have added a prop seperately to the AndroidDrawerLayoutNativeComponent such that the native component can run as expected. Does that look good to you? |
…aultProps drawerBackgroundColor
cortinico
left a comment
There was a problem hiding this comment.
Does that look good to you?
It does 👍
Please remove the gradlew file change that should not be included.
Handing over to @lunaleaps for merging this
| @@ -1,89 +1,89 @@ | |||
| @rem | |||
There was a problem hiding this comment.
Do not add this file (valid for all the gradlew files).
There was a problem hiding this comment.
oh yes must have got in there during my earlier commit! sorry! will remove it asap
There was a problem hiding this comment.
Just to clarify: you don't need to remove the file, but just to amend the changes 👍
There was a problem hiding this comment.
As @cortinico mentioned, we shouldn't be deleting these files, just undo your changes.. and similarly for the other gradlew.bat files. We probably shouldn't be touching those. @cortinico to verify
There was a problem hiding this comment.
sure will reinstatie them
|
@lunaleaps has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
| * ); | ||
| * ``` | ||
| */ | ||
| drawerBackgroundColor: ColorValue, |
There was a problem hiding this comment.
We shouldn't remove this prop as users should still be able to specify a backgroundColor other than the default
| @@ -1,89 +1,89 @@ | |||
| @rem | |||
There was a problem hiding this comment.
As @cortinico mentioned, we shouldn't be deleting these files, just undo your changes.. and similarly for the other gradlew.bat files. We probably shouldn't be touching those. @cortinico to verify
…ture/reafctorDrawerLayoutAndroidV2
Feature/reafctor drawer layout android v2
|
closed this PR as it got too messy will reopen one @lunaleaps with the suggested changes. |
Summary
Removed the deaultProps in the DrawerLayoutAndroid file and replaced it with a default value in case props are undefined.
Changelog
[General] [Changed] - Remove defaultProps from the DrawerLayoutAndroid Component.
@lunaleaps this is the fix for issue #31606
Test Plan
tested on simulator