You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change order of sending touch events and assigning new state (#2261)
## Description
This PR makes small change in `moveToState` method. Some handlers require `TouchEvents` to work. These events are not connected with state management system, unless we are talking about `ManualGestureHandler`. Right now example with this handler throws "Maximum call stack size exceeded". Stack trace points out, that the problem originates in `onCancelTouches` method.
What is happening, is that each `GestureHandler` in `moveToState` method calls `cancelTouches`, which triggers `onTouchesCancelled`. This happens, if new state will be finished (i.e. `end/failed/cancelled`). When order is not flipped, after calling `cancelTouches`, state manager calls `fail` method, which one more time triggers `moveToState`. We end up with this loop: `fail() -> moveToState() -> cancelTouches() -> fail() ...`. `Fail` method checks if current handler state is `active` or `began`, however without flipping order, `fail` is being called while handler is still in `active` state. When we flip order, `cancelTouches` is called when handler is in `end` state - that prevents falling into endless loop.
## Test plan
Tested on example app
0 commit comments