部分中斷share-external
Displaying Dynamic List of Text without Inputs
1

How can I display a list of dynamic text in my app? I can show the list using CheckboxGroup or RadioButtonGroup, but I just need the text without the checkboxes or radio buttons. The use case is to summarize a flow where the final screen displays a list of text, this is dynamic. What’s the best approach for this?

Mick
已發問 約 2 個月前
已選擇的答案
1

You can use any of the text components available, and bind the text property.

As of today, you can also use the "RichText" component, which was released with Flow JSON version 5.1.

Here's an example Flow JSON:

{
    "version": "5.1",
    "screens": [
        {
            "id": "RECOMMEND",
            "title": "Feedback 1 of 2",
            "data": {
                "dynamic_text": {
                    "type": "string",
                    "__example__": "hello, world"
                }
            },
            "terminal": true,
            "layout": {
                "type": "SingleColumnLayout",
                "children": [
                    {
                        "type": "Form",
                        "name": "flow_path",
                        "children": [
                            {
                                "type": "TextBody",
                                "text": "${data.dynamic_text}"
                            },
                            {
                                "type": "Footer",
                                "label": "Continue",
                                "on-click-action": {
                                    "name": "complete",
                                    "payload": {}
                                }
                            }
                        ]
                    }
                ]
            }
        }
    ]
}
9月17日 06:29
Bar
Priyansh

This answer, @Bar, is not relevant to what was asked

I think OP wants to add text fields according to a dynamic list in the data (change the number of components at runtime).

I am also looking into something similar, and currently do not think there is a way. Will keep this thread updated if I find anything

Thanks!

9月20日 12:25
Bar

There is no way to change the number of elements on a screen at run time, that's correct. You can, however, change the visibility of elements at run time.

For text fields, you can now use the rich text component which gives you more control on the formatting. You can dynamically set the content in this component. This could theoretically help you achieve what I understand the OP is trying to do with text components.

9月23日 09:52