Skip to content

Commit e685d2e

Browse files
committed
fix(android): second livesync
1 parent dbce285 commit e685d2e

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

tns-core-modules/ui/frame/fragment.transitions.android.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,6 @@ function toShortString(nativeTransition: android.transition.Transition): string
721721
return `${nativeTransition.getClass().getSimpleName()}@${nativeTransition.hashCode().toString(16)}`;
722722
}
723723

724-
function createDummyZeroDurationAnimation(): android.view.animation.Animation {
725-
// NOTE: returning the dummy AlphaAnimation directly does not work for some reason;
726-
// animationEnd is fired first, then some animationStart (but for a different animation?)
727-
const animationSet = new android.view.animation.AnimationSet(false);
728-
animationSet.addAnimation(new android.view.animation.AlphaAnimation(1, 1));
729-
730-
return animationSet;
731-
}
732-
733724
function printTransitions(entry: ExpandedEntry) {
734725
if (entry && traceEnabled()) {
735726
let result = `${entry.fragmentTag} Transitions:`;
@@ -756,6 +747,14 @@ function printTransitions(entry: ExpandedEntry) {
756747

757748
class NoTransition extends Transition {
758749
public createAndroidAnimation(transitionType: string): android.view.animation.Animation {
759-
return createDummyZeroDurationAnimation();
750+
const animation = new android.view.animation.AlphaAnimation(1, 1);
751+
// NOTE: this should not be necessary when we revert to Animators API
752+
// HACK: Android view animation with zero duration seems to be buggy and raises animation listener events in illogical (wrong?) order:
753+
// "enter" start -> "enter" end -> "exit" start -> "exit" end;
754+
// we would expect events to overlap "exit" start -> "enter" start -> "exit" end -> "enter" end, or at least
755+
// "exit" start / end to be raised before "enter" start / end
756+
animation.setDuration(1);
757+
758+
return animation;
760759
}
761760
}

0 commit comments

Comments
 (0)