Closed Havoc1001 closed 10 months ago
Hi, sorry for the late answer, I just saw the issue
So I tried to add this functionality now, and there were some problems. To add this functionality, I need a list of items that you have spawned, and a menu where you can delete them.
I thought of two ways to do this:
Each of this solutions has a problem: Solution 1: if you try to remove an item (button) from the menu and there are no more buttons in that submenu, NativeUI can't set the active option to any option, so it crashes. I tried solving this by taking the user to the main menu when there are no more buttons, and removing the button when the user is already in the main menu, but for some reason this still doesn't work, it still throws an error when setting the active option
Solution 2: I haven't really tried it yet, but I know that it requires completely closing, creating, and opening the menu every time you remove a prop. Using the menu like this is a pain in the ass because it will close every time you remove a prop, and performance wise, creating the menu every single time you remove a prop, is terrible.
Unfortunately the documentation for NativeUI isn't very extensive, the removeItemAtIndex function isn't documented at all. If anyone with more experience with NativeUI can help me find a solution for this, I'll add this functionality
Actually, I ended up finding another solution, a variation of the first one. It's basically creating a button that says "No props" whenever there are no props to delete to avoid the problem that happened before. It might not be the best solution, but it works. Updating the repo now
How do you delete props that you have spawned?