Make animated collapsible card component, with initial props to show or hide

前端 未结 5 1755
面向向阳花
面向向阳花 2021-01-14 03:12

Background

Using React Native I was able to make collapsible card component. On Icon click the card slides up hiding its content, or expands showing

5条回答
  •  独厮守ぢ
    2021-01-14 03:26

    The expanded value 'true/false' should be passed from the calling component and you need to use this value to expand/collapse your component. I can't see your have used 'expanded' inside render method. You should do like this:

     { this.props.expanded && 
                {this.props.children}
               }
    

提交回复
热议问题