Skip to content

Commit

Permalink
Always generate the EventEmitters (#34750)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #34750

This Diff is the first step of enabling the CodeGen  to parse and generate a NativeState for the components.

The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.

To allow the generation of custom `NativeState`, we first have to always generate a `ViewEventEmitter`: that's because the `ConcreteShadowNode` template lists the Generics with this order: `Name`, `Props`, `EventEmitter`, Others...
If we skip the `EventEmitters` and we put the `State`, React Native would think that the State is actually an `EventEmitter` and the build step will fail.

## Changelog
[General][Added] - Always generate a ViewEventEmitter for Fabric Components

Differential Revision: D39509869

fbshipit-source-id: c5d10a7cc3dec06ed8c91f523c141c439b524bdd
  • Loading branch information
Riccardo Cipolleschi authored and facebook-github-bot committed Sep 21, 2022
1 parent eddff32 commit 9383b6d
Show file tree
Hide file tree
Showing 7 changed files with 401 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT ArrayPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -46,7 +53,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT BooleanPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -73,7 +87,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT ColorPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -100,7 +121,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT EdgeInsetsPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -127,7 +155,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT EnumPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand Down Expand Up @@ -281,7 +316,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT FloatPropsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -308,7 +350,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT ImagePropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -335,7 +384,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT IntegerPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand Down Expand Up @@ -398,7 +454,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT MultiNativePropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -425,7 +488,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT NoPropsNoEventsNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -452,7 +522,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT ObjectPropsNativeComponentEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -479,7 +556,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT PointPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand All @@ -506,7 +590,14 @@ Object {
namespace facebook {
namespace react {
class JSI_EXPORT StringPropNativeComponentViewEventEmitter : public ViewEventEmitter {
public:
using ViewEventEmitter::ViewEventEmitter;
};
} // namespace react
} // namespace facebook
Expand Down
Loading

0 comments on commit 9383b6d

Please sign in to comment.