Skip to content

Commit

Permalink
Fixed bug causing ConstraintGuide to be classified as ConstrainedView
Browse files Browse the repository at this point in the history
  • Loading branch information
kwamezainar committed Dec 26, 2019
1 parent 58aeec5 commit 05e6658
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
react-constraint-layout is a Javascript library that provides a constraint based solution to position HTML elements relative to each other and to the parent **with zero CSS**.

![](https://img.shields.io/badge/react-v16.2.0+-blue)
![](https://img.shields.io/badge/minified%20size-39.7%20kB-blue)
![](https://img.shields.io/badge/minified%20size-32.7%20kB-blue)
[![](https://img.shields.io/badge/github-star-lightgrey)](https://github.com/kwameopareasiedu/react-constraint-layout)
[![](https://img.shields.io/badge/patreon-support-orange)](https://www.patreon.com/kwameopareasiedu)

Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "react-constraint-layout",
"version": "1.0.0",
"version": "1.0.1",
"description": "React implementation of Android's ConstraintLayout",
"author": "Kwame Opare Asiedu",
"license": "MIT",
"scripts": {
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook -c .storybook -o docs",
"test-build": "rollup --watch -c rollup.config.js --environment INCLUDE_DEPS,BUILD:production",
"build": "rollup -c rollup.config.js --environment INCLUDE_DEPS,BUILD:production",
"test": "echo \\\"Error: no tests specified\\\" && exit 1"
},
Expand Down Expand Up @@ -56,5 +57,6 @@
},
"peerDependencies": {
"react": "^16.12.0"
}
},
"dependencies": {}
}
6 changes: 3 additions & 3 deletions src/constraint-layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export const ConstraintLayout = ({ _ref, id, className, width, height, children
if (!isDefined(height)) throw "<ConstraintLayout /> height is required";

const childrenArray = Children.toArray(children);
const validChildPrototypes = [ConstrainedView.prototype, ConstraintLayout.prototype];
const views = childrenArray.filter(c => c.type && validChildPrototypes.includes(c.type.prototype));
const guides = childrenArray.filter(c => c.type && ConstraintGuide.prototype === c.type.prototype);
const validChildFunctions = [ConstrainedView, ConstraintLayout];
const views = childrenArray.filter(c => c.type && validChildFunctions.includes(c.type));
const guides = childrenArray.filter(c => c.type && c.type === ConstraintGuide);
const refs = useRef(Array(views.length).fill(null));
const solverRef = useRef(() => {});
const rootRef = useRef();
Expand Down

0 comments on commit 05e6658

Please sign in to comment.