Fixes #494 Add optional abort for onResizeStart #495
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add optional return boolean when calling onResizeStart to early exit and abort the resize sequence
Proposed solution
(From ticket #494)
Currently, when
onResizeStart
is called, the user providedonResizeStart
(fromprops
) is also called. In certain scenarios, however, some condition may be hit where the user wants to abort the resize.The feature request would be to allow the user to return a boolean from their defined
onResizeStart
, and if it returnsfalse
, the re-resizable'sonResizeStart
would have an early exit and not cause any resizing.Tradeoffs
Should not add any overheard or tradeoffs. This
onResizeStart
is only stopped if the user returns an explicitfalse
. I'm sure there are many cases where the return is undefined, which should be unaffected by this change.Testing Done
Confirmed locally in project. Added a test that initiates a resize, but immediately aborts. While the 'user' continues to resize, it checks the state
isResizing
state of the Resizable (should befalse
).