Skip to content

Instantly share code, notes, and snippets.

@persianturtle
Created February 15, 2018 03:02
partial from reducer field
| TouchStart(clientX) =>
if (state.nav.isOpen) {
state.nav.isSwiping := true;
};
ReasonReact.Update({
...state,
nav: {
...state.nav,
position: [clientX]
}
});
| TouchMove(clientX) =>
if (state.nav.isSwiping^) {
ReasonReact.Update({
...state,
nav: {
...state.nav,
position: [clientX, ...state.nav.position]
}
});
} else {
ReasonReact.NoUpdate;
}
| TouchEnd(clientX) =>
state.nav.isSwiping := false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment