1*fe5cfb17STomasz Sapeta #pragma once 2*fe5cfb17STomasz Sapeta 3*fe5cfb17STomasz Sapeta #include <memory> 4*fe5cfb17STomasz Sapeta #include <string> 5*fe5cfb17STomasz Sapeta #include <vector> 6*fe5cfb17STomasz Sapeta 7*fe5cfb17STomasz Sapeta #ifdef ANDROID 8*fe5cfb17STomasz Sapeta #include "TurboModule.h" 9*fe5cfb17STomasz Sapeta #else 10*fe5cfb17STomasz Sapeta #include <ABI48_0_0ReactCommon/ABI48_0_0TurboModule.h> 11*fe5cfb17STomasz Sapeta #endif 12*fe5cfb17STomasz Sapeta 13*fe5cfb17STomasz Sapeta #include <ABI48_0_0ReactCommon/ABI48_0_0CallInvoker.h> 14*fe5cfb17STomasz Sapeta 15*fe5cfb17STomasz Sapeta using namespace ABI48_0_0facebook; 16*fe5cfb17STomasz Sapeta using namespace ABI48_0_0React; 17*fe5cfb17STomasz Sapeta 18*fe5cfb17STomasz Sapeta namespace ABI48_0_0reanimated { 19*fe5cfb17STomasz Sapeta 20*fe5cfb17STomasz Sapeta class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule { 21*fe5cfb17STomasz Sapeta protected: 22*fe5cfb17STomasz Sapeta explicit NativeReanimatedModuleSpec(std::shared_ptr<CallInvoker> jsInvoker); 23*fe5cfb17STomasz Sapeta 24*fe5cfb17STomasz Sapeta public: 25*fe5cfb17STomasz Sapeta virtual void installCoreFunctions( 26*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 27*fe5cfb17STomasz Sapeta const jsi::Value &valueSetter) = 0; 28*fe5cfb17STomasz Sapeta 29*fe5cfb17STomasz Sapeta // SharedValue 30*fe5cfb17STomasz Sapeta virtual jsi::Value makeShareable( 31*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 32*fe5cfb17STomasz Sapeta const jsi::Value &value) = 0; 33*fe5cfb17STomasz Sapeta virtual jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) = 0; 34*fe5cfb17STomasz Sapeta virtual jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) = 0; 35*fe5cfb17STomasz Sapeta 36*fe5cfb17STomasz Sapeta // mappers 37*fe5cfb17STomasz Sapeta virtual jsi::Value startMapper( 38*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 39*fe5cfb17STomasz Sapeta const jsi::Value &worklet, 40*fe5cfb17STomasz Sapeta const jsi::Value &inputs, 41*fe5cfb17STomasz Sapeta const jsi::Value &outputs, 42*fe5cfb17STomasz Sapeta const jsi::Value &updater, 43*fe5cfb17STomasz Sapeta const jsi::Value &viewDescriptors) = 0; 44*fe5cfb17STomasz Sapeta virtual void stopMapper(jsi::Runtime &rt, const jsi::Value &mapperId) = 0; 45*fe5cfb17STomasz Sapeta 46*fe5cfb17STomasz Sapeta // events 47*fe5cfb17STomasz Sapeta virtual jsi::Value registerEventHandler( 48*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 49*fe5cfb17STomasz Sapeta const jsi::Value &eventHash, 50*fe5cfb17STomasz Sapeta const jsi::Value &worklet) = 0; 51*fe5cfb17STomasz Sapeta virtual void unregisterEventHandler( 52*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 53*fe5cfb17STomasz Sapeta const jsi::Value ®istrationId) = 0; 54*fe5cfb17STomasz Sapeta 55*fe5cfb17STomasz Sapeta // views 56*fe5cfb17STomasz Sapeta virtual jsi::Value getViewProp( 57*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 58*fe5cfb17STomasz Sapeta const jsi::Value &viewTag, 59*fe5cfb17STomasz Sapeta const jsi::Value &propName, 60*fe5cfb17STomasz Sapeta const jsi::Value &callback) = 0; 61*fe5cfb17STomasz Sapeta 62*fe5cfb17STomasz Sapeta // sensors 63*fe5cfb17STomasz Sapeta virtual jsi::Value registerSensor( 64*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 65*fe5cfb17STomasz Sapeta const jsi::Value &sensorType, 66*fe5cfb17STomasz Sapeta const jsi::Value &interval, 67*fe5cfb17STomasz Sapeta const jsi::Value &sensorDataContainer) = 0; 68*fe5cfb17STomasz Sapeta virtual void unregisterSensor( 69*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 70*fe5cfb17STomasz Sapeta const jsi::Value &sensorId) = 0; 71*fe5cfb17STomasz Sapeta 72*fe5cfb17STomasz Sapeta // keyboard 73*fe5cfb17STomasz Sapeta virtual jsi::Value subscribeForKeyboardEvents( 74*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 75*fe5cfb17STomasz Sapeta const jsi::Value &keyboardEventContainer) = 0; 76*fe5cfb17STomasz Sapeta virtual void unsubscribeFromKeyboardEvents( 77*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 78*fe5cfb17STomasz Sapeta const jsi::Value &listenerId) = 0; 79*fe5cfb17STomasz Sapeta 80*fe5cfb17STomasz Sapeta // other 81*fe5cfb17STomasz Sapeta virtual jsi::Value enableLayoutAnimations( 82*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 83*fe5cfb17STomasz Sapeta const jsi::Value &config) = 0; 84*fe5cfb17STomasz Sapeta virtual jsi::Value configureProps( 85*fe5cfb17STomasz Sapeta jsi::Runtime &rt, 86*fe5cfb17STomasz Sapeta const jsi::Value &uiProps, 87*fe5cfb17STomasz Sapeta const jsi::Value &nativeProps) = 0; 88*fe5cfb17STomasz Sapeta }; 89*fe5cfb17STomasz Sapeta 90*fe5cfb17STomasz Sapeta } // namespace reanimated 91