mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Use ComponentDescriptorParameters as an actual parameter of ComponentDescriptor constructor
Summary: This diff changes the signature of ComponentDescriptor constructor to make it simpler and easier to support: now all arguments are passed via struct that contains all these arguments as fields. Now the ComponentDescriptor constructor accepts three arguments one of which is optional. This causes some confusion and the possibility of bugs in all subclasses that needs to implement a custom constructor. Mostly because in every case we need to ensure that the constructor: * Accepts and pass down all parameters/arguments; * Accepts the right types of those parameters (shared vs weak pointers, references vs values). * Accepts all thee arguments and pass them (including flavor!). We failed this point several times. Overal that makes the code simpler and allows changing the set of parameters relatively easy. (There is no plan for it!) Look at the LOC balance: less code! Changelog: [INTERNAL] Reviewed By: sammy-SC Differential Revision: D18548173 fbshipit-source-id: 5d038b135e004f6c054026b3235ed57db99c086d
This commit is contained in:
1 parent
a8fbbe2350
commit
a09ab53692
15 files changed
+67
-103
No files matched your search
+3
-8
@@ -20,16 +20,11 @@ class AndroidTextInputComponentDescriptor final
|
||||
: public ConcreteComponentDescriptor<AndroidTextInputShadowNode> {
|
||||
public:
|
||||
AndroidTextInputComponentDescriptor(
|
||||
EventDispatcher::Weak eventDispatcher,
|
||||
const ContextContainer::Shared &contextContainer,
|
||||
ComponentDescriptor::Flavor const &flavor = {})
|
||||
: ConcreteComponentDescriptor<AndroidTextInputShadowNode>(
|
||||
eventDispatcher,
|
||||
contextContainer,
|
||||
flavor) {
|
||||
ComponentDescriptorParameters const ¶meters)
|
||||
: ConcreteComponentDescriptor<AndroidTextInputShadowNode>(parameters) {
|
||||
// Every single `AndroidTextInputShadowNode` will have a reference to
|
||||
// a shared `TextLayoutManager`.
|
||||
textLayoutManager_ = std::make_shared<TextLayoutManager>(contextContainer);
|
||||
textLayoutManager_ = std::make_shared<TextLayoutManager>(contextContainer_);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user