this repo has no description
1/**
2 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3 *
4 * Do not edit this file as changes may cause incorrect behavior and will be lost
5 * once the code is regenerated.
6 *
7 * @generated by codegen project: GenerateModuleH.js
8 */
9
10#pragma once
11
12#include <ReactCommon/TurboModule.h>
13#include <react/bridging/Bridging.h>
14
15namespace facebook::react {
16
17
18 class JSI_EXPORT NativeSafeAreaContextCxxSpecJSI : public TurboModule {
19protected:
20 NativeSafeAreaContextCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
22public:
23 virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
24
25};
26
27template <typename T>
28class JSI_EXPORT NativeSafeAreaContextCxxSpec : public TurboModule {
29public:
30 jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
31 return delegate_.create(rt, propName);
32 }
33
34 std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
35 return delegate_.getPropertyNames(runtime);
36 }
37
38 static constexpr std::string_view kModuleName = "RNCSafeAreaContext";
39
40protected:
41 NativeSafeAreaContextCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
42 : TurboModule(std::string{NativeSafeAreaContextCxxSpec::kModuleName}, jsInvoker),
43 delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
44
45
46private:
47 class Delegate : public NativeSafeAreaContextCxxSpecJSI {
48 public:
49 Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
50 NativeSafeAreaContextCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
51
52 }
53
54 jsi::Object getConstants(jsi::Runtime &rt) override {
55 static_assert(
56 bridging::getParameterCount(&T::getConstants) == 1,
57 "Expected getConstants(...) to have 1 parameters");
58
59 return bridging::callFromJs<jsi::Object>(
60 rt, &T::getConstants, jsInvoker_, instance_);
61 }
62
63 private:
64 friend class NativeSafeAreaContextCxxSpec;
65 T *instance_;
66 };
67
68 Delegate delegate_;
69};
70
71} // namespace facebook::react