Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Creating a component slot with .create function will not apply styles #671

Closed
@silviuaavram

Description

@silviuaavram

Bug Report

Creating a component slot with .create function will not apply styles from the styles file to that slot.

Steps

The code from DropdownLabel.tsx:

      <Label
        styles={styles.root}
        role="presentation"
        circular
        onClick={this.handleClick}
        content={header}
        icon={Icon.create(icon, {
          defaultProps: {
            'aria-label': 'Remove ${header} from selection.',
            'aria-hidden': false,
            role: 'button',
          },
          overrideProps: this.handleIconOverrides,
        })}
        image={Image.create(image, {
          defaultProps: {
            avatar: true,
          },
        })}
        {...rest}
      />

Both Icon and Image will not get styles applied to them from labelStyles.ts.
Both icon and image are shorthands, passed into the Dropdown component. To see the actual bug, go to the Dropdown component in the docs, example Multiple Search with Image and Content.

screenshot 2019-01-02 at 13 07 17

The line 132 in factories.ts might be the cause of this issue:
if (valIsReactElement) { return value as React.ReactElement<Props> }

Expected Result

Styles should be applied in all cases except when we pass an actual or component to the Dropdown props icon and image.

Actual Result

Styles are not applied.

Version

0.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    vstsPaired with ticket in vsts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions