Summary:
Now ConcreteComponentDescriptor can infer `ComponentName` from `ShadowNodeT` automatically,
so in the most cases we even don't need to create a subclass of that.
Reviewed By: fkgozali
Differential Revision: D8016965
fbshipit-source-id: d910597093c9f4c9f32ca06cb3ef1b12538b9543
Summary: We don't use them at all; moreover they complicate adding/changing signatures of those methods (because arguments with defaults must be grouped at the end and some arguments cannot have defaults).
Reviewed By: fkgozali
Differential Revision: D7981456
fbshipit-source-id: d7dd098e83630d1ab3342d2ca52ade9c4e27b2c3
Summary: Note: not all scrollview props and features (especially event listeners and imperative calls) are supported yet.
Reviewed By: fkgozali
Differential Revision: D7961868
fbshipit-source-id: 5277674fe976e089fd963066f78e705ad846d78d
Summary:
All the props of a scrollview, and local data.
LocalData part is probably the most interesting: with it we precompute content size which we use inside native scrollview. Previously we rely on some assumptions like "ScrollView must have only one subview" instead, and that was not so efficient and straight-forward.
Reviewed By: fkgozali
Differential Revision: D7961869
fbshipit-source-id: fa070b8423a3e7739aeb62220e51213683e1a223
Summary:
A few fixes:
* missing include: folly/Optional.h
* switch folly::Optional's `has_value()` to `hasValue()` for now until folly is upgraded to newer version
* fix up import for RCTTextAttributes.h
* fix up includes for "conversions.h" to use namespaced includes
Reviewed By: mmmulani
Differential Revision: D8021149
fbshipit-source-id: d3955986d3ab6b1d9b61ac1e385767893ce57e5e
Summary: We will need this for several components, first of all for ScrollView.
Reviewed By: fkgozali
Differential Revision: D7958246
fbshipit-source-id: 364b939abe8f0734376448149bbdc735abd00189
Summary: Trivial. We will need them soon at least for ScrollView.
Reviewed By: fkgozali
Differential Revision: D7958244
fbshipit-source-id: ce92c6e6181181ac17d817292af18ffa46a4d975
Summary: Apparently, `calculateMutationInstructions` must also produce mutation instructions for root node as well. To make it possible we have to change the signature of the function and weak some restrictions in TreeMutationInstruction.
Reviewed By: fkgozali
Differential Revision: D7958248
fbshipit-source-id: 4109a6bce3a77f7eb89157201fd0e80f98487dbd
Summary: Conceptually, it always must be node owner's responsibility, but for the root node, we have to make an exception because there is no another parent node and there is no another component which has access to YogaNode.
Reviewed By: fkgozali
Differential Revision: D7958251
fbshipit-source-id: 0bdaea87adbd323c758bc3c28f325be615aa90f3
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: 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