From ccfc707f3a0799f16a51eec3f89d5419351f580f Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 16 Jan 2025 01:27:26 +0100 Subject: [PATCH] format --- .../cpp/views/CachedProp.hpp | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/react-native-nitro-modules/cpp/views/CachedProp.hpp b/packages/react-native-nitro-modules/cpp/views/CachedProp.hpp index f490353f..6a6548ee 100644 --- a/packages/react-native-nitro-modules/cpp/views/CachedProp.hpp +++ b/packages/react-native-nitro-modules/cpp/views/CachedProp.hpp @@ -11,32 +11,33 @@ namespace margelo::nitro { - using namespace facebook; - - template - struct CachedProp { - public: - T value; - OwningReference jsiValue; - bool isDirty; - - public: - bool equals(jsi::Runtime& runtime, const jsi::Value& other) const { - if (!jsiValue) return false; - return jsi::Value::strictEquals(runtime, *jsiValue, other); - } - - public: - static CachedProp fromRawValue(jsi::Runtime& runtime, const jsi::Value& value, const CachedProp& oldProp) { - if (oldProp.equals(runtime, value)) { - // jsi::Value hasn't changed - no need to convert it again! - return oldProp; - } - auto converted = JSIConverter::fromJSI(runtime, value); - auto cache = JSICache::getOrCreateCache(runtime); - auto cached = cache.makeShared(jsi::Value(runtime, value)); - return CachedProp(std::move(converted), std::move(cached), /* isDirty */ true); +using namespace facebook; + +template +struct CachedProp { +public: + T value; + OwningReference jsiValue; + bool isDirty; + +public: + bool equals(jsi::Runtime& runtime, const jsi::Value& other) const { + if (!jsiValue) + return false; + return jsi::Value::strictEquals(runtime, *jsiValue, other); + } + +public: + static CachedProp fromRawValue(jsi::Runtime& runtime, const jsi::Value& value, const CachedProp& oldProp) { + if (oldProp.equals(runtime, value)) { + // jsi::Value hasn't changed - no need to convert it again! + return oldProp; } - }; + auto converted = JSIConverter::fromJSI(runtime, value); + auto cache = JSICache::getOrCreateCache(runtime); + auto cached = cache.makeShared(jsi::Value(runtime, value)); + return CachedProp(std::move(converted), std::move(cached), /* isDirty */ true); + } +}; } // namespace margelo::nitro