Hide/Show components in react native

后端 未结 24 2060
囚心锁ツ
囚心锁ツ 2020-12-07 08:43

I\'m really new to React Native and I\'m wondering how can I hide/show a component.
Here\'s my test case:



        
24条回答
  •  旧时难觅i
    2020-12-07 09:32

    i am just using below method to hide or view a button. hope it will help you. just updating status and adding hide css is enough for me

    constructor(props) {
       super(props);
          this.state = {
          visibleStatus: false
       };
    }
    updateStatusOfVisibility () {
       this.setStatus({
          visibleStatus: true
       });
    }
    hideCancel() {
       this.setStatus({visibleStatus: false});
    }
    
    render(){
       return(
        
             {this.doSearch({input: text}); this.updateStatusOfVisibility()}} />
    
             
                
                    Cancel
                
            
         )
    }
    

提交回复
热议问题