Skip to content

Passing props to the ReactFilestack element does not work as expected #73

Open
@juho

Description

@juho

We're using rmwc components with material UI. This doesn't work as expected because of your tagMap:

import { Button } from 'rmwc'
<ReactFilestack
  componentDisplayMode={{
    type: Button
  }}
/>

As the ReactFilestack component only renders the button, optimally I would expect the API to be something like this..

import { Button } from 'rmwc'
<ReactFilestack
  component={Button}
  label='Upload a file'
  className='myclass'
/>

So, in your constructor, something like this:

    const {
      apikey,
      clientOptions,
      actionOptions,
      action,
      componentDisplayMode,
      // All other named props that you need
      ...rest
    } = this.props;

    this.componentProps = {...rest};

And in your render(), something like..

  render () {
    const Component = this.componentProps.component;
    return <Component name="filestack" onClick={this.onClickPick} {...this.componentProps} />
  }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions