Layout issue when using custom components in a GridLayout
See original GitHub issueWhen using this type of layout in conjunction with Angular components (one of which uses a ListView underneath) creates the following troublesome layout.
I would expect this layout to just work:
<GridLayout rows="*,100" columns="*">
<test-list-cmp row="0" col="0"></test-list-cmp> <!-- This has ListView underneath -->
<test-cmp row="1" col="0"></test-cmp>
</GridLayout>
Simple sample project which demonstrates this problem: https://github.com/NathanWalker/layout-bug-demo
Screenshot of problem…
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Custom Component · Issue #1241 · react-grid-layout ... - GitHub
Hello, how do I use a custom component as grid item? I couldn't find anything on the guide and I'm quite new in...
Read more >Solving Common Layout Problems (The Java™ Tutorials ...
If the component is not controlled by a layout manager, you can set its size by invoking the setSize or setBounds method on...
Read more >Components in GridLayout don't show properly - Stack Overflow
It has to do with the way GridLayout behaves when both the rows and columns are set to non-zero values. The LayoutManager decides...
Read more >Statuspage custom component grid layout by group (table)
I am wondering how I could create a grid layout for my components grouped by region where each group is a region and...
Read more >Relationship of grid layout to other layout methods - CSS
This is where you want a two-dimensional layout method: You want to control the alignment by row and column, and this is where...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @NathanWalker,
I don’t think it has anything to do with the ListView. If you wrap the custom components inside a
StackLayout
and set row/col on that, the problem goes away (at least on Android).I can’t find the link with the explanation and the workaround I once had.
As I remember it, the problem is that layout properties are not inherited by the custom components. (It might have something to do with them being wrapped inside a
ProxyViewContainer
, but I can’t remember).So you either have to wrap the custom component inside a
StackLayout
OR add the layout properties inside you custom component like this:We’ve been using another workaround for a while.
If you change the
selector
to include an attribute selector, e.g. fromtest-cmp
totest-cmp, [test-cmp]
you can use the component like this:It is a lot prettier than the old workaround.