Parse custom NativeState in Flow#34753
Closed
cipolleschi wants to merge 3 commits into
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D39686251 |
Base commit: eddff32 |
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D39686251 |
01e6762 to
91b9a27
Compare
Base commit: 6ba5fa9 |
added 3 commits
September 21, 2022 10:54
Summary: Pull Request resolved: facebook#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: https://internalfb.com/D39509869 fbshipit-source-id: db5a466e7c810f0949631759dae67468f4cfe364
Summary: Pull Request resolved: facebook#34754 This Diff is the second 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. ## Changelog [General][Added] - Always generate an empty NativeState for Fabric Components Differential Revision: https://internalfb.com/D39696435 fbshipit-source-id: fd27421151393352c7882b8a5bc737f136cbe3ea
Summary: Pull Request resolved: facebook#34753 This Diff introduce a the capability to parse custom NativeStates in Flow. To achieve this I also had to define the CodegenSchema. The parsing follows the exact same rules as props, as initial heuristic. This should allow enough customization for the developers who needs a custom state. There is only a case I was not able to make it work that is STATE_ALIASED_LOCALLY, from the fixtures. I don't know how diffuse it is and I think we can live with some workarounds for the time being. This diff also adds tests for the custom Native State Flow Parser. ## Changelog [General][Added] - Implement custom Native State parsing in Flow Differential Revision: D39686251 fbshipit-source-id: dbd288bc97adcc9352dac3377be35ee90669da68
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D39686251 |
91b9a27 to
df3e57c
Compare
cipolleschi
pushed a commit
to cipolleschi/react-native
that referenced
this pull request
Sep 26, 2022
Summary: Pull Request resolved: facebook#34753 This Diff introduce a the capability to parse custom NativeStates in Flow. To achieve this I also had to define the CodegenSchema. The parsing follows the exact same rules as props, as initial heuristic. This should allow enough customization for the developers who needs a custom state. There is only a case I was not able to make it work that is STATE_ALIASED_LOCALLY, from the fixtures. I don't know how diffuse it is and I think we can live with some workarounds for the time being. This diff also adds tests for the custom Native State Flow Parser. ## Changelog [General][Added] - Implement custom Native State parsing in Flow Differential Revision: https://internalfb.com/D39686251 fbshipit-source-id: 18b3e2973bdf20b4858d416cc934f8bfa3bdb538
Collaborator
|
This pull request was successfully merged by @cipolleschi in 925b153. When will my fix make it into a release? | Upcoming Releases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This Diff introduce a the capability to parse custom NativeStates in Flow. To achieve this I also had to define the CodegenSchema.
The parsing follows the exact same rules as props, as initial heuristic. This should allow enough customization for the developers who needs a custom state.
There is only a case I was not able to make it work that is STATE_ALIASED_LOCALLY, from the fixtures. I don't know how diffuse it is and I think we can live with some workarounds for the time being.
This diff also adds tests for the custom Native State Flow Parser.
Changelog
[General][Added] - Implement custom Native State parsing in Flow
Differential Revision: D39686251