Skip to content

Commit

Permalink
Support factoryProps
Browse files Browse the repository at this point in the history
  • Loading branch information
sonaye committed Feb 19, 2019
1 parent 2f60e71 commit d92bef3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.0.9

- Support passing default props to the factory.

# 0.0.8

- Support dynamic props in `attrs()`. By default `attrs()` only overwrites the `defaultProps` of the component, now when you pass it a function it will allow for computed props.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"license": "MIT",
"name": "shakl",
"description": "A utility to create styled components in React Native.",
"version": "0.0.8",
"version": "0.0.9",
"main": "lib/index.js",
"react-native": "lib/rn.js",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import flatten from './flatten'

import { ThemeProvider, withTheme } from './theme'

const styled = (Comp, { name, multi, ...opts } = {}) => (style) => {
const styled = (Comp, { name, multi, props: factoryProps, ...opts } = {}) => (style) => {
const Styled = React.forwardRef(({ childRef, ...props }, ref) => {
const { comp, child, childProps } = opts
const { children } = props
Expand All @@ -28,6 +28,7 @@ const styled = (Comp, { name, multi, ...opts } = {}) => (style) => {
}

const parentProps = {
...factoryProps,
...attrs,
...props,
...styles,
Expand Down

0 comments on commit d92bef3

Please sign in to comment.