在本机中隐藏动态生成的按钮

时间:2018-10-17 11:26:55

标签: javascript react-native

我想在react native中隐藏动态生成的按钮 下面是我的代码。我使用了溢出:隐藏,但是它不起作用。

renderSeats() {        
    var seats = [];
    var columnCount = 2;

    for(var index = 0; index < columnCount; index++) {
        var title = (index + 1).toString();
        var isDisabled = false, isHidden = false;
        if(title == 1) {
            isDisabled = true;            
            isHidden = false;

        }               
        if(isHidden)
            seats.push(  

                <View hide={this.state.isHidden}>
                    <Button title={title} style={{overflow: "hidden"}} disabled={isDisabled}></Button>   
                </View>          
                );
        else
        seats.push(
                <View style={{overflow: "hidden"}}>
                    <Button title={title} style={{overflow: "hidden"}} disabled={isDisabled}></Button>
                </View>
                );
    }           

    return seats;
}

1 个答案:

答案 0 :(得分:0)

# m is the matrix # a is the array result = [[y in range(x[0], x[-1]) for y in a] for x in m] 用于溢出的内容。

您可以尝试overflow: hiddendisplay: none。但是,这也可能不适用于本机。

相反,您不能渲染它:

visibility: hidden