Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created October 25, 2018 05:17
Show Gist options
  • Save gskachkov/5333d8352aed4c9290095bcd6754aff0 to your computer and use it in GitHub Desktop.
Save gskachkov/5333d8352aed4c9290095bcd6754aff0 to your computer and use it in GitHub Desktop.
class LayoutWorklet {
*intrinsicSizes() {}
*layout(children, edges, constraintSpace, styles) {
const childFragments = []
console.log(constraintSpace);
for(const child of children) {
const childFragment = yield child.layoutNextFragment();
console.log(childFragment);
childFragment.inlineOffset = Math.random() * constraintSpace.fixedInlineSize;
childFragment.blockOffset = Math.random() * constraintSpace.fixedBlockSize;
childFragments.push(childFragment);
}
return {
childFragments
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment