Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSBox 版本: 2.13.0 (1165) TestFlight 下载 #1

Open
Juanepaktho opened this issue Dec 22, 2020 · 0 comments
Open

JSBox 版本: 2.13.0 (1165) TestFlight 下载 #1

Juanepaktho opened this issue Dec 22, 2020 · 0 comments

Comments

@Juanepaktho
Copy link
Owner

JSBox 版本: 2.13.0 (1165) TestFlight 下载

我理解 HomeWidget 的布局 'spacer' 对应的是 SwiftUI 里面的 Spacer 吧?但是似乎 JSBox 里面的 'spacer' 最小宽度很大的样子,在有足够的空间的情况下,能把 text 挤压到不能显示全。
比如,如下图,
IMG_0549
对应的代码是:

$widget.setTimeline({
        policy: {
            never: true,
        },
        render: ctx => {
            console.info(`size: {${ctx.displaySize.width}, ${ctx.displaySize.height}} `)
            return {
                type: 'zstack',
                views: [
                    {
                        type: 'hstack',
                        props: {
                            alignment: 'center',
                        },
                        views: [
                            {
                                type: 'vstack',
                                props: {
                                    alignment: 'leading',
                                },
                                views: [
                                    {
                                        type: 'text',
                                        props: {
                                            text: 'PlaceHolder12345',
                                            lineLimit: 1,
                                        }
                                    },
                                ]
                            },
                            {
                                type: 'spacer',
                            },
                            {
                                type: 'vstack',
                                props: {
                                    alignment: 'leading'
                                },
                                views: [
                                    {
                                        type: 'text',
                                        props: {
                                            lineLimit: 1,
                                            text: 'PlaceHolder',
                                        }
                                    }
                                ]
                            },
                        ]
                    }
                ]
            }
        }
    });

我尝试在 Xcode 下 Widget 类似的代码是不是有问题,Xcode 那边 Spacer 显示的挺正常的,如下图:
Widget_Preview
对应的代码如下:
Widget

Originally posted by @MichaelPei in https://github.com/cyanzhong/jsbox-issues/issues/90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant