The practice of making a view component visible or invisible by changing a variable set as the value of the components visibility property triggers an illegal view operation and causes app to crash on majority of android devices

Since the beginning of my journey with appgyver this has been how I have been told to make a component visible or invisible, but this is a bad practice, and has been undermining me the entire time by causing app to crash on the majority of devices, which also shows the user the very scary error screen, causing them to uninstall the app for fear if the “critical error” which is designed to be a very scary and horrible user experience for any non developer.

So, I ask now, what is the appropriate way to make a component visible or invisible, other than the set component property flow function, which does not work.

Please get it together appgyver team
Please.

1 Like

Hi @Daniel_Perley1
Now, i understood what am i doing wrong
Thanks :+1:

Hi,

Using a true/false App Variable for Component’s visibility has been the most straightforward way. With the power of formulas, you can have more sophisticated logic that controls the visibility. For instance, reversing visibility via a formula:

With that approach, I have not seen any issues yet. If you are using the same way, please give more context and report it as a bug to our Tracker, so we can fix the “illegal view operation”.

3 Likes

I use this methodology as well and it works great. I also use a similar strategy to change background colors based on the value if 1 or 0. Then use a formula and say if its 1 a certain background color is displayed otherwise the color remains static as its value is 0.

I have experimented soma problems too with this theme. I noticed that on mobile device they ares some aleatory crash making in/visible a component. It seems to be relative to the “speed” of the device/internet. In my case I solved it with a small delay in the flow (500ms)… Not a great solution but it works for me.

Well since we have no way to determine what code is being used by appgyver, we have no way of intelligently correcting the issue. In java, there is a visibility property which can be set to invisible or gone. The react native bridge method should compile down to one of these, but we have no way of knowing with appgyver.

From the crash reports, in many devices, such as a Google Pixel, when the variable set as the visibility property of a view is changed to true, it will crash the device, because the view does not exist.