Skip to content

Commit

Permalink
Make sure withLocalize forwards its ref
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwenmemon committed May 11, 2021
1 parent cd915cd commit 99c89e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/withLocalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function withLocalizeHOC(WrappedComponent) {
<WrappedComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={props.forwardedRef}
translate={translations.translate}
numberFormat={translations.numberFormat}
timestampToRelative={translations.timestampToRelative}
Expand All @@ -59,9 +60,11 @@ function withLocalizeHOC(WrappedComponent) {
WithLocalize.displayName = `WithLocalize(${getComponentDisplayName(WrappedComponent)})`;
WithLocalize.propTypes = {
preferredLocale: PropTypes.string,
forwardedRef: PropTypes.func,
};
WithLocalize.defaultProps = {
preferredLocale: 'en',
forwardedRef: null,
};
return React.forwardRef((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ReportActionCompose extends React.Component {
* Focus the composer text input
*/
focus() {
if (this.textInput && this.textInput.focus) {
if (this.textInput) {
// There could be other animations running while we trigger manual focus.
// This prevents focus from making those animations janky.
InteractionManager.runAfterInteractions(() => {
Expand Down

0 comments on commit 99c89e9

Please sign in to comment.