From 65d20082657676f16041b9552a421b35db1d6ee5 Mon Sep 17 00:00:00 2001 From: Dmytro Rykun Date: Tue, 25 Jun 2024 09:09:18 -0700 Subject: [PATCH] Update codegen artifacts for react-native-test-library Differential Revision: D59010093 --- .../viewmanagers/SampleNativeComponentManagerDelegate.java | 2 +- .../OSSLibraryExampleSpec/OSSLibraryExampleSpecJSI.h | 6 +++++- .../renderer/components/OSSLibraryExampleSpec/States.h | 5 ----- .../ios/OSSLibraryExampleSpec/OSSLibraryExampleSpec.h | 6 ++++++ .../ios/OSSLibraryExampleSpec/States.h | 5 ----- .../ios/OSSLibraryExampleSpecJSI.h | 6 +++++- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/react-native-test-library/android/src/main/java/com/facebook/react/viewmanagers/SampleNativeComponentManagerDelegate.java b/packages/react-native-test-library/android/src/main/java/com/facebook/react/viewmanagers/SampleNativeComponentManagerDelegate.java index e25a276cda9898..4883fd3ed9d644 100644 --- a/packages/react-native-test-library/android/src/main/java/com/facebook/react/viewmanagers/SampleNativeComponentManagerDelegate.java +++ b/packages/react-native-test-library/android/src/main/java/com/facebook/react/viewmanagers/SampleNativeComponentManagerDelegate.java @@ -34,7 +34,7 @@ public void setProperty(T view, String propName, @Nullable Object value) { } @Override - public void receiveCommand(T view, String commandName, ReadableArray args) { + public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) { switch (commandName) { case "changeBackgroundColor": mViewManager.changeBackgroundColor(view, args.getString(0)); diff --git a/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/OSSLibraryExampleSpecJSI.h b/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/OSSLibraryExampleSpecJSI.h index 7955b323295eec..eb8d48c555e9ae 100644 --- a/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/OSSLibraryExampleSpecJSI.h +++ b/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/OSSLibraryExampleSpecJSI.h @@ -38,11 +38,14 @@ class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule { : TurboModule(std::string{NativeSampleModuleCxxSpec::kModuleName}, jsInvoker), delegate_(reinterpret_cast(this), jsInvoker) {} + private: class Delegate : public NativeSampleModuleCxxSpecJSI { public: Delegate(T *instance, std::shared_ptr jsInvoker) : - NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {} + NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) { + + } double getRandomNumber(jsi::Runtime &rt) override { static_assert( @@ -54,6 +57,7 @@ class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule { } private: + friend class NativeSampleModuleCxxSpec; T *instance_; }; diff --git a/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/States.h b/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/States.h index f4d6efa82c0acf..c083692a8e7bd7 100644 --- a/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/States.h +++ b/packages/react-native-test-library/android/src/main/jni/react/renderer/components/OSSLibraryExampleSpec/States.h @@ -10,8 +10,6 @@ #ifdef ANDROID #include -#include -#include #endif namespace facebook::react { @@ -25,9 +23,6 @@ class SampleNativeComponentState { folly::dynamic getDynamic() const { return {}; }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; #endif }; diff --git a/packages/react-native-test-library/ios/OSSLibraryExampleSpec/OSSLibraryExampleSpec.h b/packages/react-native-test-library/ios/OSSLibraryExampleSpec/OSSLibraryExampleSpec.h index 462a85d5c430e4..1ff5010b13fced 100644 --- a/packages/react-native-test-library/ios/OSSLibraryExampleSpec/OSSLibraryExampleSpec.h +++ b/packages/react-native-test-library/ios/OSSLibraryExampleSpec/OSSLibraryExampleSpec.h @@ -14,6 +14,11 @@ #ifndef __cplusplus #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. #endif + +// Avoid multiple includes of OSSLibraryExampleSpec symbols +#ifndef OSSLibraryExampleSpec_H +#define OSSLibraryExampleSpec_H + #import #import #import @@ -41,3 +46,4 @@ namespace facebook::react { }; } // namespace facebook::react +#endif // OSSLibraryExampleSpec_H diff --git a/packages/react-native-test-library/ios/OSSLibraryExampleSpec/States.h b/packages/react-native-test-library/ios/OSSLibraryExampleSpec/States.h index f4d6efa82c0acf..c083692a8e7bd7 100644 --- a/packages/react-native-test-library/ios/OSSLibraryExampleSpec/States.h +++ b/packages/react-native-test-library/ios/OSSLibraryExampleSpec/States.h @@ -10,8 +10,6 @@ #ifdef ANDROID #include -#include -#include #endif namespace facebook::react { @@ -25,9 +23,6 @@ class SampleNativeComponentState { folly::dynamic getDynamic() const { return {}; }; - MapBuffer getMapBuffer() const { - return MapBufferBuilder::EMPTY(); - }; #endif }; diff --git a/packages/react-native-test-library/ios/OSSLibraryExampleSpecJSI.h b/packages/react-native-test-library/ios/OSSLibraryExampleSpecJSI.h index 7955b323295eec..eb8d48c555e9ae 100644 --- a/packages/react-native-test-library/ios/OSSLibraryExampleSpecJSI.h +++ b/packages/react-native-test-library/ios/OSSLibraryExampleSpecJSI.h @@ -38,11 +38,14 @@ class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule { : TurboModule(std::string{NativeSampleModuleCxxSpec::kModuleName}, jsInvoker), delegate_(reinterpret_cast(this), jsInvoker) {} + private: class Delegate : public NativeSampleModuleCxxSpecJSI { public: Delegate(T *instance, std::shared_ptr jsInvoker) : - NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {} + NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) { + + } double getRandomNumber(jsi::Runtime &rt) override { static_assert( @@ -54,6 +57,7 @@ class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule { } private: + friend class NativeSampleModuleCxxSpec; T *instance_; };