Skip to content

Commit

Permalink
Fixed Scroller and VirtualList to use setDefaultProps function
Browse files Browse the repository at this point in the history
Enact-DCO-1.0-Signed-off-by: Juwon Jeong ([email protected])
  • Loading branch information
juwonjeong committed Aug 19, 2024
1 parent 1464be0 commit 0c12a67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
9 changes: 2 additions & 7 deletions Scroller/Scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand Down
17 changes: 3 additions & 14 deletions VirtualList/VirtualList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 ?
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0c12a67

Please sign in to comment.