Giter VIP home page Giter VIP logo

Comments (4)

Tiagoperes avatar Tiagoperes commented on August 14, 2024

Hello @TakasurAtWork

It would be very nice to have sticky headers (section headers) in the ListView component. Unfortunately, this is not so simple. The ListView is one of the most complex parts of Beagle and extending it with this feature would take a considerable amount of work on both iOS and Android libs.

Because of other priorities, the team can't implement this feature right now. This is not to say we'll never implement it, but we can't put in our backlog or give it a due date. Here are some alternatives:

  • Non sticky titles: you can have titles in your data source with the support for multiple templates. They won't be sticky, but that's all you would miss. (Docs).
  • Custom component: this may not be ideal, but you could implement your whole list as a custom component. This has the disadvantage that this list's template wouldn't be server driven, but you'd be able to implement your sticky headers natively.

from beagle.

TakasurAtWork avatar TakasurAtWork commented on August 14, 2024

Custom component: this may not be ideal, but you could implement your whole list as a custom component. This has the disadvantage that this list's template wouldn't be server driven, but you'd be able to implement your sticky headers natively.

Can you please briefly explain why the list's template in a custom component cannot be server driven?

from beagle.

Tiagoperes avatar Tiagoperes commented on August 14, 2024

Let me try to better explain what I mean.

Example with the ListView (alternative 1 in my previous comment):
https://playground.usebeagle.io/#/cloud/S3-f5874f69-dae9-4a54-b527-c022b0489a10

The problem with this approach is that you have no way of making the section titles stick to the screen.

The idea of the second approach is to not use the ListView at all, but instead create a new custom component, like below:

{
  "_beagleComponent_":"custom:myList",
  "sections":[
    {
      "title":"T",
      "items":[
        {
          "name":"Telsin",
          "race":"Terris",
          "planet":"Scadrial",
          "isMistborn":false,
          "age":38,
          "sex":"female"
        },
        {
          "name":"TenSoon",
          "race":"Kandra",
          "planet":"Scadrial",
          "isMistborn":false,
          "age":40,
          "sex":"male"
        }
      ]
    },
    {
      "title":"K",
      "items":[
        {
          "name":"Kaladin",
          "race":"Alethi",
          "planet":"Roshar",
          "isMistborn":false,
          "age":24,
          "sex":"male"
        },
        {
          "name":"Kelsier",
          "race":"Half-skaa",
          "planet":"Scadrial",
          "isMistborn":true,
          "age":38,
          "sex":"male"
        }
      ]
    },
    {
      "title":"V",
      "items":[
        {
          "name":"Vin",
          "race":"Half-skaa",
          "planet":"Scadrial",
          "isMistborn":true,
          "age":20,
          "sex":"female"
        }
      ]
    }
  ]
}

Notice that we can't pass "template" to this new custom component, unless we implement how to interpret this property in the frontend.

It's easy to see that sections is a List of Section and Section is just an object with a title and a list of items. It would be straight forward to implement this property. But what type would template be if we decided to implement it? It is a structure very particular to Beagle and Beagle doesn't provide you a simple method to transform this structure into a view. Even if it id, this template must be rendered within a context (the current item). Beagle doesn't have a simple way for transforming the server driven data (_beagleComponent_, _beagleAction_, etc) into an actual view given a "current context".

This would be a neat feature. But for now, to support templates on your own custom components, you'd have to basically reimplement the ListView, which would be too much work.

from beagle.

Tiagoperes avatar Tiagoperes commented on August 14, 2024

@TakasurAtWork I hope this example helped you. I'm closing this issue due to inactivity. Feel free to reopen it if you still have a problem.

from beagle.

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.