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