From 32558261ca127553258b3df7b22983d3f331654f Mon Sep 17 00:00:00 2001 From: Joel Dean Date: Wed, 10 Nov 2021 22:01:13 -0500 Subject: [PATCH] Created a ref to store if the onCloseSettingsSheet is consumed. --- .../components/src/mobile/link-settings/index.native.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/components/src/mobile/link-settings/index.native.js b/packages/components/src/mobile/link-settings/index.native.js index 70b5a3b6e9201f..f373f54450317e 100644 --- a/packages/components/src/mobile/link-settings/index.native.js +++ b/packages/components/src/mobile/link-settings/index.native.js @@ -93,6 +93,7 @@ function LinkSettings( { const [ urlInputValue, setUrlInputValue ] = useState( '' ); const [ labelInputValue, setLabelInputValue ] = useState( '' ); const [ linkRelInputValue, setLinkRelInputValue ] = useState( '' ); + const onCloseSettingsSheetConsumed = useRef( false ); const prevEditorSidebarOpenedRef = useRef(); const { onHandleClosingBottomSheet } = useContext( BottomSheetContext ); @@ -174,6 +175,13 @@ function LinkSettings( { }, [ urlInputValue, labelInputValue, linkRelInputValue, setAttributes ] ); const onCloseSettingsSheet = useCallback( () => { + if ( onCloseSettingsSheetConsumed.current ) { + onCloseSettingsSheetConsumed.current = false; + return; + } + + onCloseSettingsSheetConsumed.current = true; + onSetAttributes(); if ( onClose ) {