Skip to content

Fix screen shaking when editing between 2 tabs #17899

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

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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