Fabric: Props now have a revision number

Summary:
Props now have a special value that represents generation number of `Props` object, which
increases when the object was constructed with some source `Props` object.

Reviewed By: mdvacca

Differential Revision: D14293939

fbshipit-source-id: 4782bf33ccf37623d4079c09cc4d0268bb6c2690
This commit is contained in:
Valentin Shergin
2019-03-01 22:11:32 -08:00
committed by Facebook Github Bot
parent ada9dbf919
commit 6bc7ef0b19
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ namespace facebook {
namespace react {
Props::Props(const Props &sourceProps, const RawProps &rawProps)
: nativeId(convertRawProp(rawProps, "nativeID", sourceProps.nativeId))
: nativeId(convertRawProp(rawProps, "nativeID", sourceProps.nativeId)),
revision(sourceProps.revision + 1)
#ifdef ANDROID
,
rawProps((folly::dynamic)rawProps)
@@ -31,6 +31,15 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible {
const std::string nativeId;
/*
* Special value that represents generation number of `Props` object, which
* increases when the object was constructed with some source `Props` object.
* Default props objects (that was constructed using default constructor) have
* revision equals `0`.
* The value might be used for optimization purposes.
*/
const int revision{0};
#ifdef ANDROID
const folly::dynamic rawProps = folly::dynamic::object();
#endif