@@ -14,18 +14,27 @@ namespace ReactTestApp
1414 : public facebook::jni::HybridClass<TurboModuleManagerDelegate,
1515 facebook::react::TurboModuleManagerDelegate>
1616 {
17+ // Signatures changed in 0.70 to avoid unnecessary string copies; see
18+ // https://github.com/facebook/react-native/commit/3337add547c60b84816ef5dad82f4ead2e8742ef
19+ #if __has_include(<ReactCommon/CompositeTurboModuleManagerDelegate.h>)
20+ using SharedCallInvoker = std::shared_ptr<facebook::react::CallInvoker> &;
21+ using StringRef = std::string &;
22+ #else
23+ using SharedCallInvoker = std::shared_ptr<facebook::react::CallInvoker>;
24+ using StringRef = std::string;
25+ #endif
26+
1727 public:
1828 static constexpr auto kJavaDescriptor =
1929 " Lcom/microsoft/reacttestapp/turbomodule/TurboModuleManagerDelegate;" ;
2030
2131 static void registerNatives ();
2232
2333 std::shared_ptr<facebook::react::TurboModule>
24- getTurboModule (const std::string name, //
25- const std::shared_ptr<facebook::react::CallInvoker> jsInvoker) override ;
34+ getTurboModule (const StringRef name, const SharedCallInvoker jsInvoker) override ;
2635
2736 std::shared_ptr<facebook::react::TurboModule>
28- getTurboModule (const std::string name, //
37+ getTurboModule (const StringRef name, //
2938 const facebook::react::JavaTurboModule::InitParams ¶ms) override ;
3039
3140 private:
@@ -36,7 +45,7 @@ namespace ReactTestApp
3645 * Test-only method. Allows user to verify whether a TurboModule can be
3746 * created by instances of this class.
3847 */
39- bool canCreateTurboModule (std::string name);
48+ bool canCreateTurboModule (const StringRef name);
4049 };
4150} // namespace ReactTestApp
4251
0 commit comments