Summary:
Yoga represents concepts like `margin`, `padding` and `position` as `edges` (aka std::array<YGValue, YGEdgeCount>).
This diff improves conversion of this data structure to string (primarily for debugging purposes).
Reviewed By: fkgozali
Differential Revision: D7958241
fbshipit-source-id: 6931c7b5d2395c28821c8daef62f609b13f112c6
Summary: Oh, my! No more `#define`s related to props conversions and debug-printing.
Reviewed By: fkgozali
Differential Revision: D7958250
fbshipit-source-id: 86950070c55f134aa3a575b9fd68fc90d865cf44
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `core` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.
Reviewed By: fkgozali
Differential Revision: D7958243
fbshipit-source-id: 500ee420d9aa562ee3c5810ef625e06541eda8fb
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `view` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.
Reviewed By: fkgozali
Differential Revision: D7958242
fbshipit-source-id: 10199d1fbb43329de93604aa383c884f5cc64dc5
Summary:
Same as previous one.
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `graphics` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.
Reviewed By: fkgozali
Differential Revision: D7958252
fbshipit-source-id: 0f33a2e6aad60befacee31486acdb9b6114d3e07
Summary:
Adopting template-generated `convertRawProp` and `debugStringConvertibleItem` functions in `attributedstring` module.
Note, to do so we have to change signatures of some conversions functions to make them more overloading-friendly.
Reviewed By: fkgozali
Differential Revision: D7958245
fbshipit-source-id: 275a58bd3955a6ceb4881bffff86bf1d4501b3d2
Summary:
We have to have automatic treatment for `optional` types. So, if we can process type `T` we can also automatically process `optional<T>.`
Support for optional allows us to not introduce new types (with embedded special "undefined" value) or pollute existing pure types (with special "undefined" value). (A lot of examples of those types can be found in AttributedString module.)
Reviewed By: fkgozali
Differential Revision: D7958249
fbshipit-source-id: 21af526a17dd0329e1262020cab8ecb902316654
Summary:
This diff opens a diffstack where we migrate the generation of all prop conversions (convertRawProp) and pretty-printing (debugStringConvertibleItem) functions to C++ templates (instead of using `#define`s).
So, this diff implements base versions of those functions as templated functions.
For now we still need #define-based version, but eventually, we will get rid of it.
Reviewed By: fkgozali
Differential Revision: D7958247
fbshipit-source-id: 24346297c1bd17e8054758f0eb84698eebfa21e2
Summary: This is continue of the work started in D7797561.
Reviewed By: fkgozali
Differential Revision: D7901244
fbshipit-source-id: 2f7a5cd9fa8c0079787e26e19c7c6c4255e54b42
Summary:
This a natiral continue of previous/ongoing work towards modernizing props pipeline.
Less defines, less code, more obvious code.
Reviewed By: fkgozali
Differential Revision: D7901246
fbshipit-source-id: 3387b6d13e21e6ec48a38c9e3708762dfe536105
Summary:
This diff contains several tight to each other changes (which can/should not be split into several diffs):
* The props parsing/conversion process was de-virtualized: we don't use virtual `apply` method to parse props anymore. Instead, we use old-fashioned constructors.
* All fields of Props classes which represent props values were marked as `const` which make impossible to modify them after the objects were created (even if we have non-const value-of/pointer-to the whole Props object). Those fields are also `public` now.
* All custom handwritten getters were removed (because we don't need them anymore).
So, now we don't need all those custom getters which makes code much more compact, performant and codegen-friendly.
Reviewed By: fkgozali
Differential Revision: D7901245
fbshipit-source-id: 9f4b1fd2da64bf963b63215ed3bd74b9d3c58dd5
Summary:
This fixes some build flavor:
```
error: destructor called on non-final 'facebook::react::Scheduler' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-virtual-dtor]
```
Reviewed By: shergin
Differential Revision: D7958022
fbshipit-source-id: 6ff64bdaa221b5c6430a98244d40d6d3789ba937
Summary: ShadowTree is an abstraction around (commited) root shadow node and managing its lifecycle.
Reviewed By: mdvacca
Differential Revision: D7857049
fbshipit-source-id: 8d530e0366fc703e4aef4ec88dd8ea990dafaaf1
Summary: `RootShadowNode` is a dedicated class for managing the root node.
Reviewed By: mdvacca
Differential Revision: D7857050
fbshipit-source-id: f15f4b177f03cea4c0fd5a60d761ee2745319d77
Summary:
Apparently, we don't need this functionality in Fabric because we compute mutation instactions during diffing anyways.
But we still need (will need) `LayoutContext` for sure.
Reviewed By: mdvacca
Differential Revision: D7857045
fbshipit-source-id: 4be2744d9abea473ead847f35f698104f94af33d
Summary:
No macros in product code.
(Not all callsites are converted yet.)
Reviewed By: mdvacca
Differential Revision: D7797561
fbshipit-source-id: da899421bf99669a0e0a2b83df6004daf14355c2
Summary:
I was shamed by Sebastian's sebmarkbage concerns (totally unrelated to this topic) about introducing another level of indirection into the system and decided to change my original plan not to support text attributes for the <Paragraph> component.
So, now <Paragraph> shares <View>, <Text> and <Paragraph> itself capabilities. That reduces the minimum amount of required components for trivial text fragment from three (Paragraph, Text, RawText) to two (Paragraph and RawText).
Special thanks for C++ for supporting multiple inheritance.
Reviewed By: mdvacca
Differential Revision: D7785889
fbshipit-source-id: dd9f2e2650bfbfd76d7d4b538adaf409f9429df3
Summary: This change registers the Text module.
Reviewed By: mdvacca
Differential Revision: D7784509
fbshipit-source-id: 0de3e432b8f975927547ba990586f99655e8322d
Summary: RCTParagraphComponentView is a UIView which can render text using TextLayoutManager.
Reviewed By: mdvacca
Differential Revision: D7751853
fbshipit-source-id: e6ee9a0f989cdf6e878390d37dbcf8a11ef90bf4
Summary: <Text> component is used to describe text attributes in React.
Reviewed By: mdvacca
Differential Revision: D7751851
fbshipit-source-id: f90a4367cad64283ee64828b0d5e24470ee3d9f7
Summary:
TextLayoutManager measures and renders text using iOS specific APIs (CoreText & TextKit).
By desing, only this module should contain platfrom-specific text functionality.
Reviewed By: mdvacca
Differential Revision: D7751852
fbshipit-source-id: fd6e1907df617fe5a4479ea08f207946765b3a45
Summary:
`fabric/attributedstring` is a simple, cross-platfrom, react-specific implementation of attributed string (aka spanned string).
This diff is the first part of this which contains text primitives (types) and conversions.
Reviewed By: fkgozali
Differential Revision: D7748704
fbshipit-source-id: d76e31807e5ac7ab1a16fd6ee6445c59de5b89a2
Summary:
Adds C++ delta client that keeps modules in memory, and can be used as a RAM bundle.
For now, this client expects a `folly::dynamic` object as payload for patches, i.e. the JSON response retrieved from Metro needs to be parsed with `folly::parseJson` by the caller.
In the future, we will replace JSON with a streaming friendly binary format.
Reviewed By: fromcelticpark
Differential Revision: D7845136
fbshipit-source-id: f003f98a2607c8354c427a7e60e01e19e20295b1
Summary: Trivial. Those are artefacts from copy-pasting from `ViewShadowNode`.
Reviewed By: mdvacca
Differential Revision: D7738576
fbshipit-source-id: 2d362cd0ff56420d54cdd0e339458ebe57049ddc
Summary:
YogaLayoutableShadowNode::enableMeasurement() connects Yoga's measuring API and Fabric measuring API.
`enableMeasurement` should be called for leaf Yoga nodes with custom content which should be measured manually during layout.
Reviewed By: mdvacca
Differential Revision: D7738574
fbshipit-source-id: ffe883905c4809290d4d973ad29dc5f0e1ec7573
Summary: Overriding `adopt` method allows subclasses to configure just created or cloned shadow nodes without overriding `create` and `clone` methods.
Reviewed By: mdvacca
Differential Revision: D7738581
fbshipit-source-id: bfe4e4e2d3d448591a3267b5ea7ca4e0800f5ba0
Summary:
LocalData might be used to communicate some infomation between `ShadowNode`s
and native component views.
We will use it soon to store (and transmit to mounting layer) prepared for rendering attributed text in Text component.
Reviewed By: mdvacca
Differential Revision: D7738582
fbshipit-source-id: 1ead23ffd105cce0b3d9aeb9fc1d0df47673be50
Summary: Trivial. We have a special data structure for it, why do not use it here?
Reviewed By: mdvacca
Differential Revision: D7738577
fbshipit-source-id: 750aa649b06f17d27906d44df07172a907cde2e5
Summary: To clone a ShadowNode we must use node's ComponentDescriptot, not parent node's one.
Reviewed By: mdvacca
Differential Revision: D7738583
fbshipit-source-id: 83656f9a761530cdaedf65663ae28b3119af75f5
Summary: We are going to have not only <View> component soon!
Reviewed By: mdvacca
Differential Revision: D7738579
fbshipit-source-id: 5165762b98d94f74d40d016722be36a04d45f264
Summary:
It's more useful and consistent now because:
- We print compound layout metrics from the correct storage (not from Yoga nodes);
- It works fro any kind of layout now (but we still have just one);
- It's much clear and straight-forward.
Reviewed By: fkgozali
Differential Revision: D7607422
fbshipit-source-id: 4c3cd2848e785a7f77c7f591e376d00c7c09ade9
Summary: Quite trivial. We need this to debug print LayoutMetrics.
Reviewed By: fkgozali
Differential Revision: D7607417
fbshipit-source-id: f4fa52ad04be9757545a8ac627db184f171288e5