Skip to content

Commit

Permalink
Merge pull request #29845 from bernhardoj/fix/28660-composer-height-n…
Browse files Browse the repository at this point in the history
…ot-resized

Update composer number of lines when window width changes
  • Loading branch information
grgia authored Nov 1, 2023
2 parents b57460d + 48aa3dc commit 6a76a12
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/Composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RNTextInput from '@components/RNTextInput';
import Text from '@components/Text';
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize';
import withNavigation from '@components/withNavigation';
import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import compose from '@libs/compose';
import * as ComposerUtils from '@libs/ComposerUtils';
Expand Down Expand Up @@ -88,8 +88,6 @@ const propTypes = {
isComposerFullSize: PropTypes.bool,

...withLocalizePropTypes,

...windowDimensionsPropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -171,6 +169,7 @@ function Composer({
isComposerFullSize,
...props
}) {
const {windowWidth} = useWindowDimensions();
const textRef = useRef(null);
const textInput = useRef(null);
const initialValue = defaultValue ? `${defaultValue}` : `${value || ''}`;
Expand Down Expand Up @@ -368,7 +367,7 @@ function Composer({
setNumberOfLines(generalNumberOfLines);
textInput.current.style.height = 'auto';
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value, maxLines, numberOfLinesProp, onNumberOfLinesChange, isFullComposerAvailable, setIsFullComposerAvailable]);
}, [value, maxLines, numberOfLinesProp, onNumberOfLinesChange, isFullComposerAvailable, setIsFullComposerAvailable, windowWidth]);

useEffect(() => {
updateNumberOfLines();
Expand Down Expand Up @@ -502,4 +501,4 @@ const ComposerWithRef = React.forwardRef((props, ref) => (

ComposerWithRef.displayName = 'ComposerWithRef';

export default compose(withLocalize, withWindowDimensions, withNavigation)(ComposerWithRef);
export default compose(withLocalize, withNavigation)(ComposerWithRef);

0 comments on commit 6a76a12

Please sign in to comment.