diff --git a/Scroller/Scroller.js b/Scroller/Scroller.js index b2d498a68..e052dd0e0 100644 --- a/Scroller/Scroller.js +++ b/Scroller/Scroller.js @@ -16,6 +16,7 @@ * @exports Scroller */ +import {setDefaultProps} from '@enact/core/util'; import {I18nContextDecorator} from '@enact/i18n/I18nDecorator'; import SpotlightContainerDecorator from '@enact/spotlight/SpotlightContainerDecorator'; import {ResizeContext} from '@enact/ui/Resizable'; @@ -60,13 +61,7 @@ const scrollerDefaultProps = { * @public */ let Scroller = (props) => { - const scrollerProps = Object.assign({}, props); - for (const prop in scrollerDefaultProps) { - // eslint-disable-next-line no-undefined - if (scrollerProps[prop] === undefined) { - scrollerProps[prop] = scrollerDefaultProps[prop]; - } - } + const scrollerProps = setDefaultProps(props, scrollerDefaultProps); // Hooks const { diff --git a/VirtualList/VirtualList.js b/VirtualList/VirtualList.js index 361e62e4a..1f6a0cc81 100644 --- a/VirtualList/VirtualList.js +++ b/VirtualList/VirtualList.js @@ -6,6 +6,7 @@ * @exports VirtualList */ +import {setDefaultProps} from '@enact/core/util'; import {I18nContextDecorator} from '@enact/i18n/I18nDecorator'; import SpotlightContainerDecorator from '@enact/spotlight/SpotlightContainerDecorator'; import {ResizeContext} from '@enact/ui/Resizable'; @@ -49,13 +50,7 @@ const virtualListDefaultProps = { * @public */ let VirtualList = (props) => { - const virtualListProps = Object.assign({}, props); - for (const prop in virtualListDefaultProps) { - // eslint-disable-next-line no-undefined - if (virtualListProps[prop] === undefined) { - virtualListProps[prop] = virtualListDefaultProps[prop]; - } - } + const virtualListProps = setDefaultProps(props, virtualListDefaultProps); const {itemSize, role, ...rest} = virtualListProps; const itemSizeProps = itemSize && itemSize.minSize ? @@ -510,13 +505,7 @@ const virtualGridListDefaultProps = { * @public */ let VirtualGridList = (props) => { - const virtualGridListProps = Object.assign({}, props); - for (const prop in virtualGridListDefaultProps) { - // eslint-disable-next-line no-undefined - if (virtualGridListProps[prop] === undefined) { - virtualGridListProps[prop] = virtualGridListDefaultProps[prop]; - } - } + const virtualGridListProps = setDefaultProps(props, virtualGridListDefaultProps); const {role, ...rest} = virtualGridListProps; const {