You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Support uncontrolled APIs for overlay components
Many overlay components in gluestack-ui, including AlertDialog, Modal, Drawer, Menu, and Popover, currently require consumers to manage their open state externally.
In larger applications, this leads to a significant amount of repetitive state-management code:
const[isOpen,setIsOpen]=useState(false);
This state usually has no business meaning. It exists only to connect a trigger to an overlay component.
When this pattern is repeated across many screens, developers either have to maintain a large number of trivial boolean states or create additional wrapper components around gluestack-ui. Both approaches add unnecessary complexity.
Controlled APIs are valuable when an overlay must be opened or closed programmatically, but they should not be required for the common case.
It would be helpful if gluestack-ui supported both controlled and uncontrolled usage, similar to other modern component libraries:
The component could also support defaultOpen for uncontrolled initialization, while retaining open and onOpenChange for controlled usage.
Suggested API capabilities:
Uncontrolled state by default
A composable Trigger component
Support for defaultOpen
Controlled open and onOpenChange as an optional escape hatch
Consistent behavior across AlertDialog, Modal, Drawer, Menu, and Popover
I migrated away from several gluestack-ui overlay components because the required state-management boilerplate became difficult to maintain across a large project.
Would the maintainers be open to supporting an uncontrolled, trigger-based API for these components?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Proposal: Support uncontrolled APIs for overlay components
Many overlay components in gluestack-ui, including AlertDialog, Modal, Drawer, Menu, and Popover, currently require consumers to manage their open state externally.
In larger applications, this leads to a significant amount of repetitive state-management code:
This state usually has no business meaning. It exists only to connect a trigger to an overlay component.
When this pattern is repeated across many screens, developers either have to maintain a large number of trivial boolean states or create additional wrapper components around gluestack-ui. Both approaches add unnecessary complexity.
Controlled APIs are valuable when an overlay must be opened or closed programmatically, but they should not be required for the common case.
It would be helpful if gluestack-ui supported both controlled and uncontrolled usage, similar to other modern component libraries:
The component could also support
defaultOpenfor uncontrolled initialization, while retainingopenandonOpenChangefor controlled usage.Suggested API capabilities:
defaultOpenopenandonOpenChangeas an optional escape hatchI migrated away from several gluestack-ui overlay components because the required state-management boilerplate became difficult to maintain across a large project.
Would the maintainers be open to supporting an uncontrolled, trigger-based API for these components?
All reactions