fix(ui): synchronize swipe action gesture handlers with latest props#31
Open
arnauda-gh wants to merge 1 commit into
Open
fix(ui): synchronize swipe action gesture handlers with latest props#31arnauda-gh wants to merge 1 commit into
arnauda-gh wants to merge 1 commit into
Conversation
Fixes bulwarkmail#30. PanResponder in SwipeableRow was created once on mount and captured initial props in a stale closure. Using mutable refs ensures gesture handlers always read and execute the latest leftAction, rightAction, mode, and onAction props.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #30
Summary
Fixes an issue where modifying swipe action configuration in settings (e.g. changing action to
delete) caused already-mounted email list rows to visually update their rendered layer (showing Trash icon and red background), but execute the stale action (mark as read) when performing the swipe gesture.Solution
useRefinstances (leftActionRef,rightActionRef,modeRef,onActionRef) insideSwipeableRow.PanRespondergesture callbacks (onMoveShouldSetPanResponder,onPanResponderMove,onPanResponderRelease,fly,fireFromBandTap) to read.currentfrom these refs.src/components/__tests__/SwipeableRow.test.tsverifying dynamic prop updates on mounted rows.!! AI WARNING !! : This PR was generated and created by AI. It has been tested on my own use case and seems to work. However have a deep look about the generated code.
Note that the issues was a bit more deep that the AI detected. I think that the settings about the swipe action where fetch after the swipe mount. In fact even if we didn't changed manually the setting the swipe action (depending on the connexion efficiency) not work even without changes.