首页 > react native中父容器宽度设为0并且overflow:'hidden'的问题【已解决】

react native中父容器宽度设为0并且overflow:'hidden'的问题【已解决】

想实现一个类似于左侧菜单的效果,代码这么写的

    <View style={styles.wrap}>
        <View style={{overflow:'hidden'},[{width:this.state.width}]}>
            <Text>Menu 1</Text>
            <Text>Menu 2</Text>
        </View>
        <View style={styles.content}>
            <TabNavigator>
            ...
            </TabNavigator>
        </View>
    </View>

在TabNavigator有个按钮,点击按钮切换this.state.width的值,但是当我设置width为0时,尽管设了overflow:hidden,但是左侧菜单还是没有完全隐藏,还有什么办法能隐藏左侧菜单不?比如类似于css中的display:none效果.

【热门文章】
【热门文章】