Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default way to set default attrs for component isn't working #7

Closed
AlxGolubev opened this issue May 28, 2019 · 0 comments 路 Fixed by #8
Closed

Default way to set default attrs for component isn't working #7

AlxGolubev opened this issue May 28, 2019 · 0 comments 路 Fixed by #8

Comments

@AlxGolubev
Copy link

AlxGolubev commented May 28, 2019

馃悰 Bug Report

Styled-components allow you to set default props for a component using .attrs() method.
Right now, after migrating to xstyled wrapper I was had to rewrite all my components like e.g.

const PasswordInput = styled(Component).attrs({ type: 'password' })`` 

to

const PasswordInput = styled(Component)``
PasswordInput.attrs = [{ type: 'password' }]

To Reproduce

  1. Create a styled component
  2. Try to pass attributes to the component in a way proposed in https://www.styled-components.com/docs/faqs#when-to-use-attrs

You'll get Object(...)(...).attrs is not a function

Expected behavior

It should work in the same way as it proposed in a documentation of a styled-components package

Link to repl or repo (highly encouraged)

https://codesandbox.io/s/festive-dhawan-rn2yw?fontsize=14 (you'll have to download the code and run on your local machine, cuz codesandbox have some troubles with your package while it's perfectly working on a local server)

Paste the results here:

npx: installed 1 in 2.141s

*** Clipboard option removed - use clipboardy or clipboard-cli directly ***


## System:
 - OS: macOS 10.14.4
 - CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
 - Memory: 58.19 MB / 16.00 GB
 - Shell: 5.3 - /bin/zsh
## Binaries:
 - Node: 11.13.0 - ~/.nenv/shims/node
 - Yarn: 1.15.2 - /usr/local/bin/yarn
 - npm: 6.7.0 - ~/.nenv/shims/npm
## npmPackages:
 - @xstyled/styled-components: 1.0.1 => 1.0.1 
 - styled-components: 4.2.0 => 4.2.0 
gregberge added a commit that referenced this issue May 28, 2019
gregberge added a commit that referenced this issue May 28, 2019
gregberge added a commit that referenced this issue May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants