1 | #include <jsi/jsi.h>
|
2 | #include <array>
|
3 |
|
4 | #define JSI_HOST_FUNCTION(NAME) \
|
5 | jsi::Value NAME( \
|
6 | jsi::Runtime &rt, \
|
7 | const jsi::Value &thisValue, \
|
8 | const jsi::Value *arguments, \
|
9 | size_t count)
|
10 |
|
11 | using namespace facebook;
|
12 |
|
13 | namespace RNScreens {
|
14 |
|
15 | class RNScreensTurboModule : public jsi::HostObject {
|
16 | static std::function<std::array<int, 2>(int)> startTransition_;
|
17 | static std::function<void(int, double)> updateTransition_;
|
18 | static std::function<void(int, bool)> finishTransition_;
|
19 | static std::function<void(int)> disableSwipeBackForTopScreen_;
|
20 |
|
21 | public:
|
22 | static const char MODULE_NAME[];
|
23 |
|
24 | RNScreensTurboModule(
|
25 | std::function<std::array<int, 2>(int)> startTransition,
|
26 | std::function<void(int, double)> updateTransition,
|
27 | std::function<void(int, bool)> finishTransition,
|
28 | std::function<void(int)> disableSwipeBackForTopScreen);
|
29 | ~RNScreensTurboModule() override;
|
30 | jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name) override;
|
31 | void set(jsi::Runtime &, const jsi::PropNameID &, const jsi::Value &)
|
32 | override;
|
33 | std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt) override;
|
34 | static JSI_HOST_FUNCTION(startTransition);
|
35 | static JSI_HOST_FUNCTION(updateTransition);
|
36 | static JSI_HOST_FUNCTION(finishTransition);
|
37 | static JSI_HOST_FUNCTION(disableSwipeBackForTopScreen);
|
38 | };
|
39 |
|
40 | }
|