UNPKG

react-native-gesture-handler

Version:

Declarative API exposing native platform touch and gesture system to React Native

46 lines (44 loc) • 1.65 kB
"use strict"; import { scheduleOperationToBeFlushed } from '../handlers/utils'; import RNGestureHandlerModule from '../RNGestureHandlerModule'; // Destructure functions that can be called on the UI thread to have // a raw HostFunction reference const { flushOperations, updateGestureHandlerConfig } = RNGestureHandlerModule; export const NativeProxy = { createGestureHandler: (handlerName, handlerTag, config) => { scheduleOperationToBeFlushed(() => { RNGestureHandlerModule.createGestureHandler(handlerName, handlerTag, config || {}); }); }, setGestureHandlerConfig: (handlerTag, newConfig) => { scheduleOperationToBeFlushed(() => { RNGestureHandlerModule.setGestureHandlerConfig(handlerTag, newConfig); }); }, // updateGestureHandlerConfig can be called on the UI thread when using // SharedValue binding, so it needs to be a worklet and calls the module // directly instead of going through the operation queue above. The native // side still applies it asynchronously. updateGestureHandlerConfig: (handlerTag, newConfig) => { 'worklet'; updateGestureHandlerConfig(handlerTag, newConfig); flushOperations(); }, dropGestureHandler: handlerTag => { scheduleOperationToBeFlushed(() => { RNGestureHandlerModule.dropGestureHandler(handlerTag); }); }, configureRelations: (handlerTag, relations) => { scheduleOperationToBeFlushed(() => { RNGestureHandlerModule.configureRelations(handlerTag, relations); }); }, installUIRuntimeBindings: () => { return RNGestureHandlerModule.installUIRuntimeBindings(); } }; //# sourceMappingURL=NativeProxy.js.map