react-constraint
v0.0.4
Published
React Constraint layout client
Downloads
7
Readme
Constraint Core
Lets say you have the LayoutDefinition object, which contains the information about an entire view, this is used with createLayoutComponent to create the Component that will be showed in the client, this component requires width and height props to work; this is a Functional Component, so each re-render would basically compute everything again.
Then with the LayoutDefinition we must generate ComponentInstance's, with this we can generate all our ConstraintInstance's.
Each ComponentInstance holds information about the component name, and defined positions for each side, it starts with unknown definitions, and the work involves knowing this definitions.
Each ConstraintInstance holds information about a constraint between two from and to components, including sides for each component involved, and distance involved, also mantains the state of if it's resolver or not.
The ResolveConstraint is the function that tries to resolve a constraint.
The ResolveLayout is the function that given the definition, width and height creates the ComponentInstance's and the ConstraintInstance's, resolves them and returns the ComponentInstance's or throws if there exists an error.