Extend the set of layout animation mocks #3974
Merged
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 PR extends #3801 by introducing layout animation types and modifiers that those animation types require to be fully functional.
Currently, the tests fail with something like:
Test plan
Creating a test (e.g. using React Native Testing Library) of a component containing any of the freshly added layout animation types and / or chained modifiers they support. E.g.:
The above example fails before the patch from this PR is introduced and succeeds afterward.
Question
One question to resolve is how closely the mocks should match the real api in the context of which modifiers apply to which animation types (e.g. not all animation types support
.stiffness()
). Doing so would require more complex mocks that are also harder to maintain for the need to keeping them in sync. An alternative, simpler approach is to add all the modifiers to all the animations - I figure it's okay since these kinds of mocks are not directly consumed in the tests - they just serve enabling test-rendering components utilising layout animations without errors. The latter is the approach I went with, but lmk if you think the other one is a better fit.