iOS eureka-forms LabelRow 隐藏条件未评估

iOS eureka-forms LabelRow hidden condition not evaluating

设置

问题

无法使 LabelRowTextAreaRow 隐藏状态一起隐藏。标签是在将两者添加到部分之前定义的。它被添加到文本之上。

代码

在用几种不同的方式定义 Condition 之后,调试时,函数似乎没有被调用。仅在前 2 个中它被调用一次,但当 TextAreaRow 更改为隐藏或显示时不会调用

    let switchRowTag = "switchRowTag"
    form +++ section
        <<< SwitchRow(switchRowTag) { row in
            row.title = "Select me"}

    // Test hiding functions ========================
    let tag = "textArea"
    let title = "Test Hiding"
    let labelTag = "\(tag)_label"
    let textArea = TextAreaRow(tag) {
        [=11=].title = title
        [=11=].tag = tag
        [=11=].placeholder = title
        [=11=].textAreaHeight = .dynamic(initialTextViewHeight: 110)
        [=11=].hidden = Condition.predicate(NSPredicate(format: "$\(switchRowTag) == false"))
    }
    let labelRow = LabelRow(labelTag) {
        [=11=].title = title
        [=11=].tag = labelTag
        /* try setting the function after adding to the section
        [=11=].hidden = Condition.function([tag], { form in
            if let textRow = form.rowBy(tag: tag) as? TextAreaRow {
                return textRow.isHidden
            } else {
                return false
            }
        })
         */
    }

    section <<< labelRow <<< textArea
    // Is never evaluated
    /*
    labelRow.hidden = Condition.function([tag], { form in
        if let textRow = form.rowBy(tag: tag) as? TextAreaRow {
            return textRow.isHidden
        } else {
            return false
        }
    })
     */
    if let labelRow = form.rowBy(tag: labelTag) as? LabelRow {
        labelRow.hidden = Condition.function([tag], { form in
            if let textRow = form.rowBy(tag: tag) as? TextAreaRow {
                return textRow.isHidden
            } else {
                return false
            }
        })
    }

目前不支持。

Eureka 仅支持重新评估隐藏条件,当与所依赖的标签相关的行具有 仅值更改 时。不是可见性的变化 (ref).