Coder Social home page Coder Social logo

css-layout-ti's Introduction

Facebook's css-layout for Titanium

Exploring how it could be used to have a more iOS-autolayout-like layout system on Titanium.

Related JIRA ticket: TIMOB-18479

How I made it work for Titanim via JS

  1. Put Layout.js in Resources/Layout.js
  2. Add Resources/computeLayout.js to fix css-layout #24.
  3. Add Resources/Template.js to translate between ListView-like templates, css-layout and then to actual Titanium views.
  4. Play with it in Resources/app.js

How it might be useful for Titanium

Idealy this would replace the existing layout system. Whenever a view is added/changed/removed it would then use the C/Java version of css-layout to compute the top/left/width/height instead of Ti's own system. If Facebook makes css-layout stable it would give us a flexbox layout system much like iOS's autolayout, more flexible then our current one.

Other ideas:

  • The Alloy view compiler could run the TSS/inline properties of a full view hierarchy through computeLayout before using them in the create*() statements. The advantage would be that the changes are JS-only, but that would come at a price.
  • React (Native)'s way to batch the creation of UI is very similar to how we now use templates for ListView and to what Carbon did as well. Would be nice to have something like Ti.UI.create(<hierarchy>).

css-layout-ti's People

Contributors

fokkezb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

css-layout-ti's Issues

Integrating this with PowerTemplates

I’ve been working in the last months on an idea that I recently implemented, called PowerTemplates.

The idea is to be able to do the following:

<ListView id="list" module="power-templates">
  <Templates>
    <ItemTemplate name="simple" itemId="[ id ]">
      <Label text="[ name ]" />
   </ItemTemplate>
  </Templates>
  <ListSection id="section"/>
</ListView>
$.section.items = [
  $.list.powerTemplates.simple.parse({ id: 12, name: 'Example' })
];

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.