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

I want to disable horizontal and vertical scrolling when dragging an event somehow #154

Closed
regina-rombangok opened this issue Nov 30, 2021 · 19 comments · Fixed by #175
Closed

Comments

@regina-rombangok
Copy link

Whenever trying to drag the event, calendar view swipe behavior and vertical scrolling behavior work at the same time. It looks like so uncomfortable to drag the event.
Is there any way to disable horizontal and vertical scrolling when dragging the event?
Thanks.

@pdpino
Copy link
Collaborator

pdpino commented Nov 30, 2021

Thanks for trying the drag and drop feature!

We have seen similar issues in some devices. To help u faster, could you please:

  • say which device are you using (emulator/physical, android/ios) and packages versions (react, react-native, react-native-week-view)
  • ideally provide a screen recording

In some devices it works well, for example android 8.1.0 emulator, react-native v0.64.2, react v17.0.1:
feature-drag-and-drop-v2-smooth

@regina-rombangok
Copy link
Author

Thanks for quick reply. I'm testing on Android emulator Pixel 2 device (API 30).
"react": "17.0.1",
"react-native": "0.64.3",
"react-native-week-view": "^0.7.0"

Here is the video I recorded

bandicam.2021-12-01.01-28-46-332.mp4

@KodyKendall
Copy link

KodyKendall commented Dec 1, 2021

I'm also seeing this when running expo, device is an iPhone 8 Plus, iOS 15.1

@pdpino
Copy link
Collaborator

pdpino commented Dec 1, 2021

Thanks both for the feedback. I will try disabling other scrollings while the event is being dragged, will let you know how it goes.

I also have been thinking of providing small feedback when the event is first pressed to be dragged, for example a little device vibration (like the android calendar does), could be helpful

@KodyKendall
Copy link

KodyKendall commented Dec 1, 2021 via email

@KodyKendall
Copy link

@pdpino have you had a chance to experiment with disabling scrollings when an event is being dragged?

@pdpino
Copy link
Collaborator

pdpino commented Dec 6, 2021

@KodyKendall sorry, not yet 🙁, I have been very busy last weeks.
I will try to make some time for this in 1-2 weeks, but I can't make any promises

@pdpino
Copy link
Collaborator

pdpino commented Jan 5, 2022

Update (sorry for the late response!):

I created this experimental branch with 2 changes:

  • Use onShouldBlockNativeResponder: () => false in the PanResponder. This might fix the problem in some cases, though it only applies to android
  • Disable the (vertical and horizontal) scrolling when an event is being dragged. Activate this behavior by providing the (experimental) prop debugLockScrollOnDrag={true}

I'm still working on providing a small feedback when the dragging starts

@regina-rombangok @KodyKendall I'd appreciate if you could test this, lmk if it improves or not in your devices

@Spunnator
Copy link

I have same problem. Any Solution?

@pdpino
Copy link
Collaborator

pdpino commented Jan 14, 2022

Hi @Spunnator , could you try the fix I mentioned in my previous comment?

@Spunnator
Copy link

@pdpino i should use your fork?

@pdpino
Copy link
Collaborator

pdpino commented Jan 17, 2022

Yes but only this branch for testing, if possible.
I keep my fork up to date with this repo

@pdpino
Copy link
Collaborator

pdpino commented Mar 1, 2022

Update: I'm still debugging this

  • This bug occurs in really specific cases, due to how ScrollViews in react-native work
    • Apparently, can only be fixed with native code
  • If you do not provide onEventPress neither onEventLongPress callbacks, you should not see this problem. (Although probably most use-cases need those callbacks)
  • I may try with the react-native-gesture-handler library
    • Pros: should be able to fix this problem, get smoother interactions, maybe even provide feedback when the dragging start
    • Cons: extra library requirement

@Salmankhan033
Copy link

Salmankhan033 commented Mar 3, 2022

When I drop the event on midline means half in one date and half of another date then it can't adjust automatically?
Is there any way that it does not drop the event on the midline (date separate line)
Drawing

@pdpino
Copy link
Collaborator

pdpino commented Mar 4, 2022

@Salmankhan033 this seems like a question unrelated to this issue (correct me if I'm wrong 😅). Could you please open a different issue with the same question? I'll answer there

Also, the current behavior when you drop the event in your example is that will go to March 5 or March 6, depending on the exact pixel where you drop it. What are you expecting? I'm not sure I understand.

@Salmankhan033
Copy link

let's discuss on #165

@Salmankhan033
Copy link

I want, when I drag event then off the horizontal scroll and enable vertical scroll?

@pdpino
Copy link
Collaborator

pdpino commented Mar 16, 2022

I want, when I drag event then off the horizontal scroll and enable vertical scroll?

Answering in #174

@pdpino
Copy link
Collaborator

pdpino commented Mar 16, 2022

I fixed this 😄. I had to add the libraries react-native-gesture-handler and react-native-reanimated as dependencies (they work much better than bare react-native APIs). @hoangnm let me know if you agree with this requirement

feature-v2

I'll be sending a PR

Note: the event gets the opacity lowered to 0.5 while dragging, but we could customize this in the future (is feasible with the new libs)

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

Successfully merging a pull request may close this issue.

6 participants