Comments (5)
You can create such a scrollable layout using a CollectionLayout, like this:
var FlexScrollView = require('famous-flex/FlexScrollView');
var CollectionLayout = require('famous-flex/layouts/CollectionLayout');
var scrollView = new FlexScrollView({
layout: CollectionLayout,
layoutOptions: {
itemSize: function(renderNode, size) {
return [
size[0] / 5, // width = 1/5th of parent-width
size[1] / 4 // height = 1/4th of parent-height
]
}
}
});
from famous-flex.
How much overhead is in there in the CollectionLayout vs GridLayout? I wonder if it could be a good idea to combine them into a single layout that behaves differently (e.g. caps the number of items) depending on whether or not it's parent is a FlexScrollView or LayoutController. Since CollectionLayout is still essentially laid out in a grid anyways, either way maybe it could also accept a cells
option (instead of itemSize
) to avoid the need for the dev to write such a function on their own. Just a thought for discussion.
from famous-flex.
Actually, that is a very good idea. I've been wanting to merge those for some time now, but just haven't gotten around to it. Like you said, just adding the 'cells' option to CollectionLayout would make GridLayout obsolete. I will try to find some time to get this done, shouldn't be that much work.
from famous-flex.
I've added the cells
option to CollectionLayout and GridLayout has been deprecated.
Cheers
from famous-flex.
Haha, too fast! 👏
Thanks :)
from famous-flex.
Related Issues (20)
- velocity limit HOT 10
- Scrollview is only partially shown (after blurring an input element, window scroll position isnt reset) HOT 9
- Pull to refresh on desktop HOT 3
- any plans to support https://github.com/Famous/engine/tree/v1.0.0? HOT 7
- Scrollview: scroll without animation HOT 3
- Invalid bower version HOT 2
- FlexScrollView - mousepad two finger scrolling doesn't work in paginated view
- LayoutController insert 0 not working HOT 6
- CollectionLayout last row just partial visible HOT 1
- WheelLayout (DatePicker) sometimes wrong number sequence HOT 7
- Possible Bug in CollectionLayout HOT 5
- Is mixed-mode really good(right) ? HOT 7
- What is the state of Famous-Flex? HOT 6
- Surface leakage issue because of Entity.register HOT 2
- Bug in DatePicker.Component.FullDay HOT 7
- SamsaraJS support
- Error: HOT 6
- Correction in documentation HOT 2
- Use famous-sizeconstraint with FlexScrollView
- Changes to LinkedListViewSequence does not get reflected in FlexScrollView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from famous-flex.