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