-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Layout Animations rewrite #3332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
0fa7649
Stashing work
kmagiera fd6bc69
Stashing moar work
kmagiera bcfa8e3
Stashing moar work
kmagiera ae65f1a
Fix entering animation flicker
kmagiera 35d72a4
Even moar changes
kmagiera 75e963a
Sort out ref dependency cycle between animations manager and layout p…
kmagiera e6ad2ad
Naming cleanup
kmagiera 53fc972
Work on interrupting entering with layout animation
kmagiera 65447aa
Fix overriding enter with layout
kmagiera d1d7116
Fix lint and some warnings
kmagiera 754720a
Remove even more old, unused code
kmagiera cf59766
Stashing work on Android
kmagiera 752add2
entering
jwajgelt 46b0306
layout, exiting
jwajgelt e7287d1
Merge branch 'layoutanim_rewrite' into @jwajgelt/layout-animations
jwajgelt 3c65659
use NativeHierarchyManager to resolve ViewManagers
jwajgelt 7990c04
keep only exiting views in AnimationsManager
jwajgelt a68f0b7
Rewrite view deletion logic in AnimationsManager
jwajgelt f9e76f0
fix nested `exiting` animations
jwajgelt 61631de
fix ios nested exiting animations, disable view interaction on android
jwajgelt f69a5ae
Merge branch 'main' into layoutanim_rewrite
kmagiera deac27b
fix exiting not running for entering views
jwajgelt a17b6f3
Android cleanup
jwajgelt cc5ac2c
fix linter errors
jwajgelt f04a6e6
Fix color handling
piaskowyk d6bb8da
code review changes
jwajgelt 8314587
handle startLayoutAnimation being called before initializing LayoutAn…
jwajgelt 6312882
code review changes
jwajgelt fcae36c
fix fabric ios
jwajgelt 3c8ac7a
add layout animation examples
jwajgelt 17beed4
add remaining types
jwajgelt 690f37b
more code review changes
jwajgelt 99c5edb
remove layout animation configs when not needed
jwajgelt 7aba259
remove animation config when removing views on iOS
jwajgelt c042065
Merge branch 'main' into layoutanim_rewrite
piaskowyk d4f6010
Fix nativeProxy for Fabric
piaskowyk b81203e
add comment about magic constant
jwajgelt 06f3e49
Add new examples
tomekzaw 0d66c07
add code review changes
jwajgelt 06713ef
fix ios reporting error on removing views
jwajgelt 7a7a367
Update android/src/main/cpp/NativeProxy.cpp
jwajgelt 03a1f1e
code review fixes
jwajgelt 47cc15f
fix cleanup of layout animations
jwajgelt a84d5a7
fix typo
jwajgelt 1ef44f1
fix imports
jwajgelt 9744ae5
Merge branch 'main' into layoutanim_rewrite
jwajgelt dfc6da6
remove only roots of to-be-removed trees on Android
jwajgelt a5ae203
remove only roots of to-be-removed trees on iOS
jwajgelt be4fd9f
Fix race condition by @kmagiera
piaskowyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,56 @@ | ||
#pragma once | ||
|
||
#include <ErrorHandler.h> | ||
#include <jsi/jsi.h> | ||
#include <stdio.h> | ||
#include <functional> | ||
#include <map> | ||
#include <memory> | ||
#include <mutex> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace reanimated { | ||
|
||
using namespace facebook; | ||
|
||
class MutableValue; | ||
class ShareableValue; | ||
jwajgelt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class LayoutAnimationsProxy { | ||
public: | ||
LayoutAnimationsProxy( | ||
std::function<void(int, jsi::Object newProps)> _notifyAboutProgress, | ||
std::function<void(int, bool)> _notifyAboutEnd); | ||
std::function<void(int, jsi::Object newProps)> progressHandler, | ||
std::function<void(int, bool, bool)> endHandler, | ||
std::weak_ptr<ErrorHandler> weakErrorHandler); | ||
|
||
void | ||
startObserving(int tag, std::shared_ptr<MutableValue> sv, jsi::Runtime &rt); | ||
void stopObserving(int tag, bool finished); | ||
void notifyAboutCancellation(int tag); | ||
void stopObserving(int tag, bool finished, bool removeView); | ||
void configureAnimation( | ||
int tag, | ||
const std::string &type, | ||
std::shared_ptr<ShareableValue> config, | ||
std::shared_ptr<ShareableValue> viewSharedValue); | ||
bool hasLayoutAnimation(int tag, const std::string &type); | ||
void startLayoutAnimation( | ||
jsi::Runtime &rt, | ||
int tag, | ||
const std::string &type, | ||
const jsi::Object &values); | ||
void clearLayoutAnimationConfig(int tag); | ||
|
||
private: | ||
std::function<void(int, jsi::Object newProps)> notifyAboutProgress; | ||
std::function<void(int, bool)> notifyAboutEnd; | ||
std::map<int, std::shared_ptr<MutableValue>> observedValues; | ||
std::function<void(int, jsi::Object newProps)> progressHandler_; | ||
std::function<void(int, bool, bool)> endHandler_; | ||
std::weak_ptr<ErrorHandler> weakErrorHandler_; | ||
std::unordered_map<int, std::shared_ptr<MutableValue>> observedValues_; | ||
std::unordered_map<int, std::shared_ptr<ShareableValue>> viewSharedValues_; | ||
std::unordered_map<int, std::shared_ptr<ShareableValue>> enteringAnimations_; | ||
std::unordered_map<int, std::shared_ptr<ShareableValue>> exitingAnimations_; | ||
std::unordered_map<int, std::shared_ptr<ShareableValue>> layoutAnimations_; | ||
mutable std::mutex | ||
animationsMutex_; // Protects `enteringAnimations_`, `exitingAnimations_`, | ||
// `layoutAnimations_` and `viewSharedValues_`. | ||
}; | ||
|
||
} // namespace reanimated |
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.