-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Keep using default navigation animation direction with RTL languages #520
Conversation
Hey @ManueGE, Thanks for this PR 👍 I'll have to dig a bit deeper regarding this one. My first thought is -- are you able to easily achieve this effect at the client level? I don't really like the idea of changing the behavior of I think it's better to use the terms |
I'm actually not changing the behavior of Adding a I can fix it at client level easily, but anyway I am using my own fork of Hero in my app because it has another change I needed (#513), so it is not blocking me at all. Thanks. |
I added Also added What do you think? |
@ManueGE This seems both reasonable and flexible to me, thanks 👍 Going to see if anyone else has some input on this issue so that I'm not dictating a decision |
Any new with this PR? |
@@ -249,9 +259,9 @@ class DefaultAnimationPreprocessor: BasePreprocessor { | |||
if animators.contains(where: { $0.canAnimate(view: toView, appearing: true) || $0.canAnimate(view: fromView, appearing: false) }) { | |||
defaultAnimation = .none | |||
} else if inNavigationController { | |||
defaultAnimation = presenting ? .push(direction:.left) : .pull(direction:.right) | |||
defaultAnimation = presenting ? .push(direction:.leading) : .pull(direction:.trailing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ManueGE The only thing that concerns me is now we're changing the behavior of this animation. I agree that it's nice to change things based on the userInterfaceLayoutDirection
-- but a Hero user could be relying on this not being changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right, I understand that some users could be relying on this even if maybe it's not the "right" behavior. I saw it as a bug fix, but I understand your point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this configurable so that users can opt-in to the old behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me think about it a little bit. Will try to figure out something tomorrow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change. I kept the "left to right" default behavior, but "user interface" and "right to left" behaviors can be set using the defaultTransitionDirectionStrategy
property of HeroTransition
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ManueGE. I skimmed this earlier this week. This looks totally reasonable 👍 Will review tomorrow and hopefully merge + release!
} else if inTabBarController { | ||
defaultAnimation = presenting ? .slide(direction:.left) : .slide(direction:.right) | ||
defaultAnimation = presenting ? .push(direction:.leading) : .pull(direction:.trailing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we change from .slide
to .push
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, you are right. My bad, will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@ManueGE Yeah, I was able to review this a bit and left you some comments above. Sorry I've been swamped at work for months now 😞 If you need me to look at something the best way is to ping me on GitHub or DM me on Twitter 😓 |
Also added `.leadingToTrailing` and `trailingToLeading` Cascade direction
right to left and user interface behaviours can be set using the `defaultTransitionDirectionStrategy` property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛵️
- Fix iOS demo app failing and style on iOS 13 - Fix lint warnings and build errors in demo app - Add extra metadata to podspec - Deprecated messages to renamed - Add Joe Mattiello into Podspec authors for publishing - Fix pod lib lint failures - Update Podspec imports to match source imports - Use more minimal import - Remove Swift files from framework bundle products - Remove access modifier warnings (#616) - GitIgnore xcode log files - Docs - Run jazzy against new spec - Docs - Update jazzy config - Bump version to 1.5.0 - Set theme jekyll-theme-midnight - Use custom snapshot for views that implements HeroCustomSnapshotView (#541) - Keep using default navigation animation direction with RTL languages (#520) - Hidden subviews not taken in account in optimized snapshot type (#521) - Update Collection 2.0 (#553) Signed-off-by: Joe Mattiello <[email protected]> # gpg: Signature made Mon Oct 28 21:28:30 2019 EDT # gpg: using RSA key 8D361039DCE5C34A90E4E466A4679EBF9DE83365 # gpg: Good signature from "Joseph Mattiello <[email protected]>" [ultimate] # gpg: aka "Joseph Mattiello <[email protected]>" [ultimate] # gpg: aka "Joseph Mattiello <[email protected]>" [ultimate] # gpg: aka "Joseph Mattiello <[email protected]>" [ultimate] # gpg: aka "Joseph Mattiello (Public Git repo commit identity) <[email protected]>" [ultimate] # Conflicts: # Sources/Extensions/UIView+Hero.swift # Sources/Extensions/UIViewController+Hero.swift
If the user is using an RTL (right to left) language, the navigation controller is expected to use the inverse transition directions by default:
.right
for pushing and.left
for popping.Currently, it is not working, and the navigation controllers behave as it does in LTR languages.
This commit fixes this issue.