-
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
Use defaultProps instead of hardcoded value #10567
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import React from 'react'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import PropTypes from 'prop-types'; | ||
import {Keyboard, View} from 'react-native'; | ||
import {Keyboard, Platform, View} from 'react-native'; | ||
import lodashGet from 'lodash/get'; | ||
import _ from 'underscore'; | ||
import lodashFindLast from 'lodash/findLast'; | ||
|
@@ -227,7 +227,10 @@ class ReportScreen extends React.Component { | |
reportClosedAction = lodashFindLast(this.props.reportActions, action => action.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED); | ||
} | ||
return ( | ||
<ScreenWrapper style={[styles.appContent, styles.flex1, {marginTop: this.state.viewportOffsetTop}]}> | ||
<ScreenWrapper | ||
style={[styles.appContent, styles.flex1, {marginTop: this.state.viewportOffsetTop}]} | ||
keyboardAvoidingViewBehavior={Platform.OS === 'android' ? '' : 'padding'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would refactor this to follow our JS guidelines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe we just ... wont? IDK... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean if we want we could create something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming in here because I ran into this warning: Question: Why doesn't this default to "height" for android since that's what's being done in the android file above? Request: Please refactor this to follow our platform conventions. Leaving code like this only let's contributors see the pattern and follow it. I recently read through the README section "Cross Platform 99.9999%" and it's a good refresher of why we do this. We should not compromise here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was some conversation about this being temporary to help unblock the deploy but I'm guessing it just did not get cleaned up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC @Julesssss found a better solution for this problem.
roryabraham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
> | ||
<HeaderView | ||
reportID={reportID} | ||
onNavigationMenuButtonClicked={() => Navigation.navigate(ROUTES.HOME)} | ||
|
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 not add these to
propTypes
?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.
They are in the prop types, but they're not required.
index.android.js
andindex.js
provide defaults, butBaseScreenWrapper
does not, so I just added it as a required prop hereThere 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.
sorry why does it need to be required?
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 see what you were suggesting. Done!
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.
we are still passing a default in the
defaultProps
for this. so I think we can just remove this and if we want to be able to pass a string then add it here it's okApp/src/components/ScreenWrapper/propTypes.js
Lines 24 to 25 in e6b6dd2
?
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.
Think we still wanted to add the
''
here but maybe it's fine it will just do a warning 🤷