Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrumorariu committed Dec 6, 2024
1 parent ad577ef commit cee293a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ThemeDecorator/I18nFontDecorator.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import hoc from '@enact/core/hoc';
import ilib from '@enact/i18n';
import {useEffect} from 'react';
import PropTypes from 'prop-types';
import {useEffect} from 'react';

import {fontOverrideGenerator} from './fontGenerator';

const I18nFontDecorator = hoc((config, Wrapped) => {
const I18nDecorator = (props) => {
const ilibLocale = ilib.getLocale();

useEffect(() => {
fontOverrideGenerator(props.locale || ilib.getLocale());
}, [props.locale]);
fontOverrideGenerator(props.locale || ilibLocale);
}, [ilibLocale, props.locale]);

return <Wrapped {...props} />;
};

I18nDecorator.displayName = 'I18nFontDecorator';

I18nDecorator.propTypes = {
locale: PropTypes.string
};
Expand Down

0 comments on commit cee293a

Please sign in to comment.