diff --git a/src/components/Composer/index.js b/src/components/Composer/index.js index 02042d86a6e0..f8045eb87f9f 100755 --- a/src/components/Composer/index.js +++ b/src/components/Composer/index.js @@ -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'; @@ -88,8 +88,6 @@ const propTypes = { isComposerFullSize: PropTypes.bool, ...withLocalizePropTypes, - - ...windowDimensionsPropTypes, }; const defaultProps = { @@ -171,6 +169,7 @@ function Composer({ isComposerFullSize, ...props }) { + const {windowWidth} = useWindowDimensions(); const textRef = useRef(null); const textInput = useRef(null); const initialValue = defaultValue ? `${defaultValue}` : `${value || ''}`; @@ -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(); @@ -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);