File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export interface UniqueShowOptions {
3535}
3636
3737export interface UniqueContextProps {
38- show : ( options : UniqueShowOptions ) => void ;
38+ show : ( options : UniqueShowOptions , isOpen : ( ) => boolean ) => void ;
3939 hide : ( delay : number ) => void ;
4040}
4141
Original file line number Diff line number Diff line change @@ -309,6 +309,9 @@ export function generateTrigger(
309309 }
310310 } ) ;
311311
312+ // Support ref
313+ const isOpen = useEvent ( ( ) => mergedOpen ) ;
314+
312315 useLayoutEffect ( ( ) => {
313316 setInternalOpen ( popupVisible || false ) ;
314317 } , [ popupVisible ] ) ;
@@ -347,9 +350,7 @@ export function generateTrigger(
347350 ! parentContext
348351 ) {
349352 if ( mergedOpen ) {
350- Promise . resolve ( ) . then ( ( ) => {
351- uniqueContext . show ( getUniqueOptions ( 0 ) ) ;
352- } ) ;
353+ uniqueContext . show ( getUniqueOptions ( 0 ) , isOpen ) ;
353354 } else {
354355 uniqueContext . hide ( 0 ) ;
355356 }
@@ -395,7 +396,7 @@ export function generateTrigger(
395396 // If there is a parentContext, don't call uniqueContext methods
396397 if ( uniqueContext && unique && openUncontrolled && ! parentContext ) {
397398 if ( nextOpen ) {
398- uniqueContext . show ( getUniqueOptions ( delay ) ) ;
399+ uniqueContext . show ( getUniqueOptions ( delay ) , isOpen ) ;
399400 } else {
400401 uniqueContext . hide ( delay ) ;
401402 }
You can’t perform that action at this time.
0 commit comments