Skip to content

Commit 7f8cf06

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Update codegen to use StateData (#51823)
Summary: Pull Request resolved: #51823 Refactor C++ codegen to use StateData for simple codegenerated components changelog: [internal] internal Reviewed By: javache Differential Revision: D75889787 fbshipit-source-id: 47edf5a2a7b7d0efa1f98d392b8c7457af5747c9
1 parent 0df71ea commit 7f8cf06

2 files changed

Lines changed: 61 additions & 341 deletions

File tree

packages/react-native-codegen/src/generators/components/GenerateStateH.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const FileTemplate = ({
3333
*/
3434
#pragma once
3535
36+
#include <react/renderer/core/StateData.h>
3637
#ifdef RN_SERIALIZABLE_STATE
3738
#include <folly/dynamic.h>
3839
#endif
@@ -46,17 +47,7 @@ ${stateClasses}
4647

4748
const StateTemplate = ({stateName}: {stateName: string}) =>
4849
`
49-
class ${stateName}State {
50-
public:
51-
${stateName}State() = default;
52-
53-
#ifdef RN_SERIALIZABLE_STATE
54-
${stateName}State(${stateName}State const &previousState, folly::dynamic data){};
55-
folly::dynamic getDynamic() const {
56-
return {};
57-
};
58-
#endif
59-
};
50+
using ${stateName}State = StateData;
6051
`.trim();
6152

6253
module.exports = {

0 commit comments

Comments
 (0)