Skip to content

Commit

Permalink
Merge pull request #159 from paolotozzo/with-filters-ts
Browse files Browse the repository at this point in the history
withFilters is missing in typings.d.ts #158
  • Loading branch information
inlet authored Nov 7, 2019
2 parents 15415cf + 920e031 commit 584040c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,27 @@ export const applyDefaultProps: <P extends object>(
oldProps: P,
newProps: P
) => void;

/**
* High Order Component handy for creating a wrapper one,
* which applies one or more filters to its children
*
* @example
*
* render() {
* return (
* <Container>
* <BlurAndAdjustmentFilter
* blurFilter={{'blur': 5}}
* adjustmentFilter={{'gamma': 3, 'brightness': 5}}
* >
* <Sprite texture={texture} />
* </BlurAndAdjustmentFilter>
* </Container>
* )
* }
*/
export const withFilters: <T extends { [key: string]: any }>(
WrappedComponent: React.ComponentType, filters?: Array<any>
) => React.ComponentClass<Omit<Partial<T>, 'children'>;
2 changes: 1 addition & 1 deletion src/hoc/withFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const withFilters = (WrappedComponent, filters) => {
filterWrapper.displayName = 'FilterWrapper'
filterWrapper.propTypes = {
children: PropTypes.node,
apply: PropTypes.function,
apply: PropTypes.func,
}

return filterWrapper
Expand Down

0 comments on commit 584040c

Please sign in to comment.