How to close component when i tap second time?

Now i have this one:

When I tap to this component it shows me this one:

Now i want to close this when i tap second time to the component that will as previous.

How can I do that?

Hi,

You’ll need to add some kind of check after the Component tap event to determine if you should hide or show the component. It depends on how you have implemented the showing of the component, but I’m guessing you could add an IF logic node after the component tap event, and in the condition check if the component is showing or not. Depending on the outcome, you then either hide or show the component. If you provide me with more details on how you have implemented the showing of the component, I can help you in more detail.

Hi! I want to create custom dropdown menu, like this.
drop-down-menu

Now i did “hide component” for items and when i tap to the dropdown i showed them.

Now, i don’t know what to use for items to hide them back…

Hi!

Alright, thanks for the details! So I’d say you have two options:

You can create a variable of a true/false type that tracks if the components are showing. When the components are hidden it’s set as false, when the components are shown it’s set as true. Then, after the component tap even you can add a IF node to check if the component are hidden or not, and depending on the outcome use hide / show components.

Another option is to use the node Set component property instead of Hide and Show component. In Set component property you can set the component visibility value as opposite of what it currently is, so !component.visibility , so at each tap the component visibility value switches.

HI!
Could you please elaborate how exactly it works? So in my case I have two containers. Container 1 is visible and visibility of Container 2 set to false in Advanced properties. I used Set component property, so when I tap on Container 1, Container 2 becomes visible. I passed “!component.visibility” in formula of visibility, but Container 2 doesn’t hide itself after second tap. What am I doing wrong? :slight_smile:

Hi!

Actually there seems to be a bug in the set component property flow function when setting the property of another component, sorry for the inconvenience and misleading tips!

So in the meantime that we get it fixed I would recommend you use a true/false variable to track the visibility of the container. So bind the container’s visible property to the variable, and after tapping Container 1 set the variable to its opposite value :slight_smile: