Skip to content

Commit

Permalink
Merge pull request #10567 from Expensify/Rory-ScreenWrapperBehavior
Browse files Browse the repository at this point in the history
Use defaultProps instead of hardcoded value

(cherry picked from commit 44b6637)
  • Loading branch information
Luke9389 authored and OSBotify committed Aug 25, 2022
1 parent 3c8be8d commit 1003945
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/ScreenWrapper/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ const ScreenWrapper = props => (
<BaseScreenWrapper
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
keyboardAvoidingViewBehavior="height"
>
{props.children}
</BaseScreenWrapper>
);

defaultProps.keyboardAvoidingViewBehavior = 'height';

ScreenWrapper.propTypes = propTypes;
ScreenWrapper.defaultProps = defaultProps;

Expand Down
7 changes: 5 additions & 2 deletions src/pages/home/ReportScreen.js
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';
Expand Down Expand Up @@ -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'}
>
<HeaderView
reportID={reportID}
onNavigationMenuButtonClicked={() => Navigation.navigate(ROUTES.HOME)}
Expand Down

0 comments on commit 1003945

Please sign in to comment.