Skip to content

MapFilter.actionButton option ignores nested content #74

Description

@GoGoCarl

Example:

<MapFilter 
  ...options,
  actionButton={<Button fab mini color='primary' onClick={this.handleClick}><SaveIcon color='accent' /></Button>} />

I would expect this to produce a floating action button with a save icon in the button.

Instead, the button is display with no icon.

Upon inspecting the element itself, the Button icon does not have any children.

I'd venture to guess the element is being cloned and the clone is shallow, thus ignoring child elements (and, in this case, ignoring the SaveIcon in the example above).

I am able to support these findings by wrapping the button and icon in a component class, and then using it as the actionButton parameter, as shown in this workaround:

class ActionButton extends Component {
  render () {
    return (
      <Button fab mini color='primary' onClick={this.props.onClick}><SaveIcon color='accent' /></Button>
    )
  }
}

class MyWrapper extends Component {
  render () {
    return (
      <MapFilter
        ...options,
        actionButton={<ActionButton onClick={this.handleClick} />} />
    )
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions