GithubHelp home page GithubHelp logo

Comments (5)

IjzerenHein avatar IjzerenHein commented on August 16, 2024

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.

gadicc avatar gadicc commented on August 16, 2024

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.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

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.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

I've added the cells option to CollectionLayout and GridLayout has been deprecated.
Cheers

from famous-flex.

gadicc avatar gadicc commented on August 16, 2024

Haha, too fast! 👏

Thanks :)

from famous-flex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.