Skip to content

Commit

Permalink
Merge pull request #17899 from hungvu193/fix-16931
Browse files Browse the repository at this point in the history
Fix screen shaking when editing between 2 tabs
  • Loading branch information
aldo-expensify authored Apr 25, 2023
2 parents 63a292a + 38f9692 commit 8d661d2
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {InteractionManager, Keyboard, View} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {withOnyx} from 'react-native-onyx';
import reportActionPropTypes from './reportActionPropTypes';
import styles from '../../../styles/styles';
import Composer from '../../../components/Composer';
Expand All @@ -26,7 +25,6 @@ import CONST from '../../../CONST';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import withKeyboardState, {keyboardStatePropTypes} from '../../../components/withKeyboardState';
import ONYXKEYS from '../../../ONYXKEYS';
import * as ComposerUtils from '../../../libs/ComposerUtils';

const propTypes = {
Expand All @@ -36,9 +34,6 @@ const propTypes = {
/** Draft message */
draftMessage: PropTypes.string.isRequired,

/** Number of lines for the draft message */
numberOfLines: PropTypes.number,

/** ReportID that holds the comment we're editing */
reportID: PropTypes.string.isRequired,

Expand Down Expand Up @@ -67,7 +62,6 @@ const defaultProps = {
forwardedRef: () => {},
report: {},
shouldDisableEmojiPicker: false,
numberOfLines: undefined,
preferredSkinTone: CONST.EMOJI_DEFAULT_SKIN_TONE,
};

Expand All @@ -82,7 +76,6 @@ class ReportActionItemMessageEdit extends React.Component {
this.onSelectionChange = this.onSelectionChange.bind(this);
this.addEmojiToTextBox = this.addEmojiToTextBox.bind(this);
this.setExceededMaxCommentLength = this.setExceededMaxCommentLength.bind(this);
this.updateNumberOfLines = this.updateNumberOfLines.bind(this);
this.saveButtonID = 'saveButton';
this.cancelButtonID = 'cancelButton';
this.emojiButtonID = 'emojiButton';
Expand Down Expand Up @@ -160,14 +153,6 @@ class ReportActionItemMessageEdit extends React.Component {
}
}

/**
* Update the number of lines for a draft in Onyx
* @param {Number} numberOfLines
*/
updateNumberOfLines(numberOfLines) {
Report.saveReportActionDraftNumberOfLines(this.props.reportID, this.props.action.reportActionID, numberOfLines);
}

/**
* Delete the draft of the comment being edited. This will take the comment out of "edit mode" with the old content.
*/
Expand Down Expand Up @@ -303,8 +288,6 @@ class ReportActionItemMessageEdit extends React.Component {
}}
selection={this.state.selection}
onSelectionChange={this.onSelectionChange}
numberOfLines={this.props.numberOfLines}
onNumberOfLinesChange={this.updateNumberOfLines}
/>
<View style={styles.editChatItemEmojiWrapper}>
<EmojiPickerButton
Expand Down Expand Up @@ -346,12 +329,6 @@ export default compose(
withLocalize,
withWindowDimensions,
withKeyboardState,
withOnyx({
numberOfLines: {
key: ({reportID, action}) => `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${reportID}_${action.reportActionID}`,
initWithStoredValues: false,
},
}),
)(React.forwardRef((props, ref) => (
/* eslint-disable-next-line react/jsx-props-no-spreading */
<ReportActionItemMessageEdit {...props} forwardedRef={ref} />
Expand Down

0 comments on commit 8d661d2

Please sign in to comment.