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