Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

使用Flexbox布局时,css解析有问题

Open
#79 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
css, lua

Research direction

Open Assets/kit/pica.lua around line 180 and read the CSS parsing branch shown in the issue. Reproduce the View example with justify-content set to space-between, then verify that the parser accepts the hyphenated value and produces the expected CSS output.

Written by the indexing model from the issue text.

Description

问题
<View css="{justify-content='space-between'}"></View>

这样的写法,会报错:

space_between isn't a valid key in valid Dic {
    center = 1;
    "flex-end" = 2;
    "flex-start" = 0;
    "space-around" = 4;
    "space-between" = 3;
}
原因

原因是对css的解析不严谨,将css字符串整体将-替换为_,之后对css属性替换回来,值没有替换回来。

elseif (_v.name == "css") then
    _v.value = _gsub(_v.value, "-","_")
    local paramFun = sys:loadstring("return " .. _v.value)
    local t = paramFun()
    local css = ""
    for _k, _v in pairs(t) do
        _k = _gsub(_k, "_","-")
        if (_find(_k, "margin")) then
            css = css .. _k .. ":" .. _v*sys.scale .. ","
        else
            css = css .. _k .. ":" .. _v .. ","
        end
    end

https://github.com/alibaba/LuaViewSDK/blob/master/IOS/luaviewEx/luaviewEx/Assets/kit/pica.lua#L180

Dominant language
Objective-C
Stars
3.7k
Forks
760
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alibaba/LuaViewSDK

All issues in alibaba/LuaViewSDK

Similar issues

More Objective-C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.