Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

fix: don't consider velocity and gesture distance if gesture didn't end #810

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

satya164
Copy link
Owner

@satya164 satya164 commented Jun 19, 2019

previously, when gesture wasn't active, we checked if the gesture exceeded the minimum threshold (this was due to activeOffsetX not being respected on Android),

  • if yes, we calculate the next position based on gesture distance or velocity
  • if no, we transition to what the value of index was

this addressed 2 cases: the first condition would trigger when a gesture was performed, the second one will trigger if the index changed due to other means such as state update.
this check was mistakenly removed in e7f832c

the new code checked for State.END, which resulted in the tab switch due to state update not working at times. this is because the gestureState value is different when a gesture was cancelled, e.g. due to a vertical gesture or focus on an input element.

closes #806, closes #809

@satya164 satya164 requested a review from osdnk June 19, 2019 07:38
@satya164 satya164 force-pushed the @satya164/fix-tab-change branch 3 times, most recently from 01bc244 to f4bba71 Compare June 19, 2019 14:21
previously, when gesture wasn't active, we checked if the gesture exceeded the minimum threshold (this was due to activeOffsetX not being respected on Android),
- if yes, we calculate the next position based on gesture distance or velocity
- if no, we transition to what the value of index was

this addressed 2 cases: the first condition would trigger when a gesture was performed, the second one will trigger if the index changed due to other means such as state update.
this check was mistakenly removed in e7f832c

the new code checked for `State.END`, which resulted in the tab switch due to state update not working at times. this is because the `gestureState` value is different when a gesture was cancelled, e.g. due to a vertical gesture or focus on an input element.

closes #806, closes #809
@satya164 satya164 force-pushed the @satya164/fix-tab-change branch from f4bba71 to 1cefb27 Compare June 19, 2019 14:24
Copy link
Collaborator

@osdnk osdnk left a comment

Choose a reason for hiding this comment

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

Terribly sorry for breaking changes and these issues.

Also sorry, you had to wait for so long for my review!

@osdnk osdnk merged commit fb6d4e9 into master Jun 21, 2019
@osdnk osdnk deleted the @satya164/fix-tab-change branch June 21, 2019 19:16
@osdnk
Copy link
Collaborator

osdnk commented Jun 21, 2019

Can someone make a release? My internet connection here is too slow to install yarn 😒

@satya164
Copy link
Owner Author

Terribly sorry for breaking changes and these issues.

Nah. I should've written some comments initially on why that was done. Easy mistake to make 😃

ankeetmaini pushed a commit to ankeetmaini/react-native-tab-view that referenced this pull request Jul 7, 2019
…nd (satya164#810)

previously, when gesture wasn't active, we checked if the gesture exceeded the minimum threshold (this was due to activeOffsetX not being respected on Android),
- if yes, we calculate the next position based on gesture distance or velocity
- if no, we transition to what the value of index was

this addressed 2 cases: the first condition would trigger when a gesture was performed, the second one will trigger if the index changed due to other means such as state update.
this check was mistakenly removed in satya164@e7f832c

the new code checked for `State.END`, which resulted in the tab switch due to state update not working at times. this is because the `gestureState` value is different when a gesture was cancelled, e.g. due to a vertical gesture or focus on an input element.

closes satya164#806, closes satya164#809
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tabs don't switch after a vertical gesture TabView seems to ignore state if keyboard was opened
2 participants