/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #if __has_include() // CocoaPod headers on Apple #include #elif __has_include("AppSpecsJSI.h") // Cmake headers on Android #include "AppSpecsJSI.h" #else // BUCK headers #include #endif #include #include #include #include namespace facebook::react { #pragma mark - Structs using ConstantsStruct = NativeCxxModuleExampleCxxBaseConstantsStruct; template <> struct Bridging : NativeCxxModuleExampleCxxBaseConstantsStructBridging< bool, int32_t, std::string> {}; using ObjectStruct = NativeCxxModuleExampleCxxBaseObjectStruct< int32_t, std::string, std::optional>; template <> struct Bridging : NativeCxxModuleExampleCxxBaseObjectStructBridging< int32_t, std::string, std::optional> {}; using ValueStruct = NativeCxxModuleExampleCxxBaseValueStruct; template <> struct Bridging : NativeCxxModuleExampleCxxBaseValueStructBridging< double, std::string, ObjectStruct> {}; #pragma mark - implementation class NativeCxxModuleExample : public NativeCxxModuleExampleCxxSpec { public: NativeCxxModuleExample(std::shared_ptr jsInvoker); void getValueWithCallback( jsi::Runtime &rt, AsyncCallback callback); std::vector> getArray( jsi::Runtime &rt, std::vector> arg); bool getBool(jsi::Runtime &rt, bool arg); ConstantsStruct getConstants(jsi::Runtime &rt); int32_t getEnum(jsi::Runtime &rt, int32_t arg); std::map> getMap( jsi::Runtime &rt, std::map> arg); double getNumber(jsi::Runtime &rt, double arg); ObjectStruct getObject(jsi::Runtime &rt, ObjectStruct arg); std::set getSet(jsi::Runtime &rt, std::set arg); std::string getString(jsi::Runtime &rt, std::string arg); std::string getUnion(jsi::Runtime &rt, float x, std::string y, jsi::Object z); ValueStruct getValue(jsi::Runtime &rt, double x, std::string y, ObjectStruct z); AsyncPromise getValueWithPromise(jsi::Runtime &rt, bool error); void voidFunc(jsi::Runtime &rt); }; } // namespace facebook::react