Skip to content

Commit

Permalink
feat: initial turbo module setup
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Oct 7, 2024
1 parent 9478232 commit 66e4b34
Show file tree
Hide file tree
Showing 10 changed files with 15,245 additions and 37 deletions.
13 changes: 9 additions & 4 deletions cpp/react-native-basis-universal.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include "react-native-basis-universal.h"

namespace basisuniversal {
double multiply(double a, double b) {
return a * b;
}
namespace facebook::react {

ReactNativeBasisUniversal::ReactNativeBasisUniversal(std::shared_ptr<CallInvoker> jsInvoker)
: NativeBasisUniversalCxxSpecJSI(jsInvoker), _callInvoker(jsInvoker) {}

double ReactNativeBasisUniversal::multiply(jsi::Runtime &rt, double a, double b) {
return a * b;
}

}
26 changes: 20 additions & 6 deletions cpp/react-native-basis-universal.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#ifndef BASISUNIVERSAL_H
#define BASISUNIVERSAL_H
#pragma once

namespace basisuniversal {
double multiply(double a, double b);
}
#include <ReactCommon/TurboModule.h>
#include <RNBasisUniversalSpecJSI.h>

#endif /* BASISUNIVERSAL_H */
namespace facebook::react {

using namespace facebook;

class ReactNativeBasisUniversal : public NativeBasisUniversalCxxSpecJSI {
public:
explicit ReactNativeBasisUniversal(std::shared_ptr<CallInvoker> jsInvoker);

public:
double multiply(jsi::Runtime &rt, double a, double b) override;
constexpr static auto kModuleName = "BasisUniversal";

private:
std::shared_ptr<CallInvoker> _callInvoker;
};

} // namespace facebook::react
7 changes: 6 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ require "#{ws_dir}/node_modules/react-native-test-app/test_app.rb"

workspace 'BasisUniversalExample.xcworkspace'

use_test_app!
options = {
:fabric_enabled => true,
:bridgeless_enabled => true,
}

use_test_app! options
Loading

0 comments on commit 66e4b34

Please sign in to comment.