Skip to content

Fix: OnSlidingComplete is launched at the end of tap event #336

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

Merged
merged 5 commits into from
Oct 20, 2021

Conversation

BartoszKlonowski
Copy link
Member

This pull request fixes #306
It delivers the onSlidingComplete event fired at the end of tap gesture.


The implementation is done for both Windows and iOS platforms:

  • Windows - has a state machine implemented basing on sent status flags. This state machine is based on the order of events launched during both dragging and tap gestures.
    This solution is different from other platforms, as currently there's no decent way to override the drag/tap gestures handlers, which would allow to easily launch selected events.
  • iOS - this implementation is simple: is just launches the missing event when tap gesture is handled.
    NOTE: the additional change implemented for iOS is that it is now consistent with the Android platform - the start event has the starting value, while change and complete events are sending the updated value of Slider.

The Start event of Slider for Android sends the lastValue which acts as
a point where the thumb was when slider was clicked.
This value should also be sent on iOS platform to keep the behavior
consisent.
The state machine for handling the Start->Update->Complete events is
used to avoid multiplication of events when flags for sending status are
used.
This solution was implemented because there's no clear way to override
the default drag/tap events on the slider. So to avoid reimplementing
the whole architecture the flags and state machines has been used.
@BartoszKlonowski BartoszKlonowski added platform: iOS Issue related to iOS platform platform: Windows Issue related to Windows platform labels Oct 20, 2021
The `EventType` enum has been previously used to recognize the action
performed on the Slider. But due to using flags for a state machine this
enum is no longer required and can be safely removed.
@BartoszKlonowski BartoszKlonowski merged commit 22e2ce3 into main Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: iOS Issue related to iOS platform platform: Windows Issue related to Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onSlidingComplete doesn't fire when slider is clicked to different position in react-native-windows
1 participant