-
Notifications
You must be signed in to change notification settings - Fork 41
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
Supported declarative animation api (Android) #766
Merged
Merged
Conversation
This file contains 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
Created the animation from the prop. Returned it from onCreateAnimation instead of creating from the resource file. Can tell which enter/exit based on the enter flag together with the nextAnim id - will use 0 for mount and -1 for crumb
Same as for enter except this animation is on the scene and using -1 as the nextAnim indicator
Allowed for absolute and % values - will need to accept numbers as well as strings, will turn them into strings before sending to native because native expects a single type
Accepts from/to and pivot to match the inputs to scale animation. Also defaulted values based on direction because the scene is always going to/from the whole screen
Not just translate values anymore, used for all animations
Can't set from/to to 0 on exit/enter because the result of from - to determines the direction of the rotation. For example to rotate clockwise once would pass from 360 and to 0 - but to rotate anticlockwise once would pass from 0 and to 360
Recursively parsed the animations in items and populated into an AnimationSet
Specifying the top level duration overrides the individual durations set on each animation. So only set it if it's been set in the prop
Accepted startX/Y instead of to/fromX/Y so that can use the same prop definition for both enter and exit. Converted start into to/from in js so send the to/from values to native
Now start syntax means don't need the from parameter, can support object for the animation props. Don't need the function because don't need any params
Saves having to accept both like will have to with the translate and scale (because can be %)
Some properties, like fromX, accept strings and nubmers ('5%' or 5), but can't pass both to native. So converted these to strings
Preferred to do it like this than loop over properties. Seems simpler
Converted arrays into object { items: arr } on js side so that native doesn't have to know about it.
The crumb coming back to be active wasn't showing the material transition
Not sure why hadn't done this before for the transition api. Maybe unlikely to use material transition when replacing (the unmount animation plays for the replaced scene, not the crumb one)?
Fluently navigate from A to A -> B -> C then navigate back. This fell over because the reenter animation for B was null when using the fluent api. When fluently navigating to C the prevFragment of B wasn't in the fragmentManager because the commit is async. So stored the prevFragment as went along instead - no need to get from the FragmentManager for fluent
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.
Don't need anim resx files to create transitions anymore. Can do it all through a declarative api. Specify the starting position of an umounted/crumb scene and the Navigation router will animate the transition. Uses the same underlying native animation api as before but new's up
Animation
objects instead of loading them from resx files.For example, here's how to define the transition from the Twitter sample
Don't need to know the
from
direction of the transition anymore. But it's still available for more complicate scenarios, for example, an asymmetric unmount transition (where the 'from' doesn't match the 'to').Couldn't configure the shape of the
crumb/unmountStyle
props in the native spec on Fabric. Pretty sure Fabric still doesn't support arrays of objects. But it didn't matter because Fabric passed the whole prop to native anyway. For example, theReadableMap
had an array ofitems
even thoughitems
wasn't in the native spec.