Skip to content

Commit b6a5138

Browse files
Remove SampleTurboCxxModule example
Summary: Changelog: [Internal] The sample is from an outdated approach of enabling C++ Modules in RN which is not recommended anymore. Prefer C++ Turbo Modules if you need to expose / access C or C++ APIs in RN apps: https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules It is not included in any RNTester app at this time Differential Revision: D77771111
1 parent aaab941 commit b6a5138

File tree

5 files changed

+4
-330
lines changed

5 files changed

+4
-330
lines changed

packages/react-native/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp

Lines changed: 0 additions & 151 deletions
This file was deleted.

packages/react-native/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/react-native/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp

Lines changed: 0 additions & 96 deletions
This file was deleted.

packages/react-native/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#pragma once
9-
10-
#include <memory>
11-
12-
#include "NativeSampleTurboCxxModuleSpecJSI.h"
13-
14-
namespace facebook::react {
15-
16-
/**
17-
* A sample implementation of the C++ spec. In practice, this class can just
18-
* extend jsi::HostObject directly, but using the spec provides build-time
19-
* type-safety.
20-
*/
21-
class SampleTurboCxxModule : public NativeSampleTurboCxxModuleSpecJSI {
22-
public:
23-
SampleTurboCxxModule(std::shared_ptr<CallInvoker> jsInvoker);
24-
25-
void voidFunc(jsi::Runtime& rt) override;
26-
bool getBool(jsi::Runtime& rt, bool arg) override;
27-
double getEnum(jsi::Runtime& rt, double arg) override;
28-
double getNumber(jsi::Runtime& rt, double arg) override;
29-
jsi::String getString(jsi::Runtime& rt, const jsi::String& arg) override;
30-
jsi::Array getArray(jsi::Runtime& rt, const jsi::Array& arg) override;
31-
jsi::Object getObject(jsi::Runtime& rt, const jsi::Object& arg) override;
32-
jsi::Object getValue(
33-
jsi::Runtime& rt,
34-
double x,
35-
const jsi::String& y,
36-
const jsi::Object& z) override;
37-
void getValueWithCallback(jsi::Runtime& rt, const jsi::Function& callback)
38-
override;
39-
jsi::Value getValueWithPromise(jsi::Runtime& rt, bool error) override;
40-
jsi::Object getConstants(jsi::Runtime& rt) override;
41-
};
42-
43-
} // namespace facebook::react
8+
// This header is left here for informational reasons.
9+
// Refer to packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.h
10+
// for a concrete example.
11+
// See: https://reactnative.dev/docs/the-new-architecture/pure-cxx-modules

packages/rn-tester/RNTester/AppDelegate.mm

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#import <React/RCTLinkingManager.h>
1515
#import <ReactCommon/RCTSampleTurboModule.h>
1616
#import <ReactCommon/RCTTurboModuleManager.h>
17-
#import <ReactCommon/SampleTurboCxxModule.h>
1817

1918
#import <React/RCTPushNotificationManager.h>
2019

@@ -83,10 +82,6 @@ - (BOOL)application:(UIApplication *)app
8382
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
8483
jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
8584
{
86-
if (name == std::string([@"SampleTurboCxxModule" UTF8String])) {
87-
return std::make_shared<facebook::react::SampleTurboCxxModule>(jsInvoker);
88-
}
89-
9085
if (name == facebook::react::NativeCxxModuleExample::kModuleName) {
9186
return std::make_shared<facebook::react::NativeCxxModuleExample>(jsInvoker);
9287
}

0 commit comments

Comments
 (0)