Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope drawer drag workaround to feed pagers #1694

Merged
merged 1 commit into from
Oct 13, 2023
Merged

Scope drawer drag workaround to feed pagers #1694

merged 1 commit into from
Oct 13, 2023

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Oct 13, 2023

We have a patch that makes the drawer gesture coexist with feed pagers. However, this patch breaks the overdrag in iOS lightbox. We want to enable this patch only for feed pagers. We could've introduced a prop for this, but conceptually, we really just want to disable the hack when overdrag is on (because it breaks overdrag, and feed pagers don't use overdrag).

By default it's false. We only turn it on for the lightbox right now. So this fixes the lightbox.

This does that.

Test plan

  • Verified dragging the drawer still works for the feed pager
  • Verified overdrag is fixed for the lightbox.

You'd need to yarn prebuild to get the new behavior.

@gaearon gaearon requested a review from pfrazee October 13, 2023 19:15
@@ -30,13 +30,13 @@ index ab0fc7f..fbbf19f 100644
if (self.reactViewController.navigationController != nil && self.reactViewController.navigationController.interactivePopGestureRecognizer != nil) {
[self.scrollView.panGestureRecognizer requireGestureRecognizerToFail:self.reactViewController.navigationController.interactivePopGestureRecognizer];
}
@@ -463,4 +467,21 @@
@@ -463,4 +467,21 @@ - (NSString *)determineScrollDirection:(UIScrollView *)scrollView {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk why my git decided to add these but ok

- (BOOL)isLtrLayout {
return [_layoutDirection isEqualToString:@"ltr"];
}
+
+- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
+ if (otherGestureRecognizer == self.scrollView.panGestureRecognizer) {
+ if (!_overdrag && otherGestureRecognizer == self.scrollView.panGestureRecognizer) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!_overdrag && is the actual change here

Copy link
Collaborator

@pfrazee pfrazee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay seems to work!

@pfrazee pfrazee merged commit 9042f50 into main Oct 13, 2023
4 checks passed
@pfrazee pfrazee deleted the overdrag-fix branch October 13, 2023 22:15
estrattonbailey added a commit that referenced this pull request Oct 19, 2023
…e-post-tags-into-app

* origin/main:
  Fix four gallery images for Firefox (#1710)
  Performance optimization  (#1676)
  Scope drawer drag workaround to feed pagers (#1694)
  Toggle lightbox controls on tap (#1687)
  Fix profile preview jump (#1693)
@troZee
Copy link

troZee commented Nov 9, 2023

@gaearon would you mind adding this fix into https://github.com/callstack/react-native-pager-view?

@okwasniewski @krozniata

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 9, 2023

This isn't really a fix tbh, more of a hack for our case. I'm not sure what a proper fix would be since it depends on how your drawer works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants