react-native-gesture-handler
Version:
Declarative API exposing native platform touch and gesture system to React Native
33 lines (28 loc) • 796 B
JavaScript
;
import { State } from '../State';
import { tagMessage } from '../utils';
const setGestureState = (handlerTag, state) => {
'worklet';
if (globalThis._setGestureStateSync) {
globalThis._setGestureStateSync(handlerTag, state);
} else if (globalThis._setGestureStateAsync) {
globalThis._setGestureStateAsync(handlerTag, state);
} else {
throw new Error(tagMessage('Failed to set gesture state'));
}
};
export const GestureStateManager = {
activate(handlerTag) {
'worklet';
setGestureState(handlerTag, State.ACTIVE);
},
fail(handlerTag) {
'worklet';
setGestureState(handlerTag, State.FAILED);
},
deactivate(handlerTag) {
'worklet';
setGestureState(handlerTag, State.END);
}
};
//# sourceMappingURL=gestureStateManager.js.map