@@ -33,7 +33,7 @@ const RemovableIosWithRemove = ({
3333 const { window } = useDOM ( ) ;
3434
3535 const removeButtonRef = React . useRef < HTMLElement > ( null ) ;
36- const disabledRef = React . useRef ( true ) ;
36+ const [ removeButtonDisabled , setRemoveButtonDisabled ] = React . useState ( true ) ;
3737 const [ removeOffset , updateRemoveOffset ] = React . useState ( 0 ) ;
3838
3939 React . useEffect ( ( ) => {
@@ -51,9 +51,10 @@ const RemovableIosWithRemove = ({
5151 const onRemoveTransitionEnd = ( ) => {
5252 if ( removeOffset > 0 ) {
5353 removeButtonRef ?. current ?. focus ( ) ;
54- } else {
55- disabledRef . current = true ;
54+ return ;
5655 }
56+
57+ setRemoveButtonDisabled ( true ) ;
5758 } ;
5859
5960 const onRemoveActivateClick = ( e : React . MouseEvent ) => {
@@ -62,7 +63,7 @@ const RemovableIosWithRemove = ({
6263 return ;
6364 }
6465 const { offsetWidth } = removeButtonRef . current ;
65- disabledRef . current = false ;
66+ setRemoveButtonDisabled ( false ) ;
6667 updateRemoveOffset ( offsetWidth ) ;
6768 } ;
6869
@@ -97,7 +98,7 @@ const RemovableIosWithRemove = ({
9798 Component = "button"
9899 hasActive = { false }
99100 hasHover = { false }
100- disabled = { disabledRef . current }
101+ disabled = { removeButtonDisabled }
101102 getRootRef = { removeButtonRef }
102103 className = { styles . remove }
103104 onClick = { onRemove }
0 commit comments