@nativescript/core 8.5.0-alpha.3 → 8.5.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,8 @@
1
1
  import { Transition } from '.';
2
- import { Screen } from '../../platform';
3
- import { iOSNativeHelper } from '../../utils/native-helper';
4
2
  import { isNumber } from '../../utils/types';
5
3
  import { GestureStateTypes } from '../gestures';
6
- import { SharedTransition, SharedTransitionAnimationType, DEFAULT_DURATION, DEFAULT_SPRING } from './shared-transition';
4
+ import { SharedTransition, DEFAULT_DURATION } from './shared-transition';
5
+ import { SharedTransitionHelper } from './shared-transition-helper';
7
6
  export class PageTransition extends Transition {
8
7
  iosNavigatedController(navigationController, operation, fromVC, toVC) {
9
8
  this.navigationController = navigationController;
@@ -32,7 +31,9 @@ export class PageTransition extends Transition {
32
31
  view.on('pan', this._interactiveDismissGesture);
33
32
  this._interactiveGestureTeardown = () => {
34
33
  // console.log(`-- TEARDOWN setupInteractiveGesture --`);
35
- view.off('pan', this._interactiveDismissGesture);
34
+ if (view) {
35
+ view.off('pan', this._interactiveDismissGesture);
36
+ }
36
37
  this._interactiveDismissGesture = null;
37
38
  };
38
39
  return this._interactiveGestureTeardown;
@@ -41,6 +42,14 @@ export class PageTransition extends Transition {
41
42
  if (args?.ios?.view) {
42
43
  // console.log('this.id:', this.id);
43
44
  const state = SharedTransition.getState(this.id);
45
+ if (!state) {
46
+ // cleanup and exit, already shutdown
47
+ if (this._interactiveGestureTeardown) {
48
+ this._interactiveGestureTeardown();
49
+ this._interactiveGestureTeardown = null;
50
+ }
51
+ return;
52
+ }
44
53
  const percent = state.interactive?.dismiss?.percentFormula ? state.interactive.dismiss.percentFormula(args) : args.deltaX / (args.ios.view.bounds.size.width / 2);
45
54
  if (SharedTransition.DEBUG) {
46
55
  console.log('Interactive dismissal percentage:', percent);
@@ -88,10 +97,7 @@ export class PageTransition extends Transition {
88
97
  var PercentInteractiveController = /** @class */ (function (_super) {
89
98
  __extends(PercentInteractiveController, _super);
90
99
  function PercentInteractiveController() {
91
- var _this = _super !== null && _super.apply(this, arguments) || this;
92
- _this.started = false;
93
- _this.added = false;
94
- return _this;
100
+ return _super !== null && _super.apply(this, arguments) || this;
95
101
  }
96
102
  PercentInteractiveController.initWithOwner = function (owner) {
97
103
  var ctrl = PercentInteractiveController.new();
@@ -101,12 +107,14 @@ var PercentInteractiveController = /** @class */ (function (_super) {
101
107
  PercentInteractiveController.prototype.startInteractiveTransition = function (transitionContext) {
102
108
  var _a;
103
109
  // console.log('startInteractiveTransition');
104
- this.transitionContext = transitionContext;
105
- if (!this.started) {
106
- this.started = true;
110
+ if (!this.interactiveState) {
111
+ this.interactiveState = {
112
+ transitionContext: transitionContext,
113
+ };
107
114
  var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.deref();
108
115
  if (owner) {
109
- this.transitionContext.containerView.insertSubviewBelowSubview(owner.presenting.view, owner.presented.view);
116
+ var state = SharedTransition.getState(owner.id);
117
+ SharedTransitionHelper.interactiveStart(state, this.interactiveState, 'page');
110
118
  }
111
119
  }
112
120
  };
@@ -114,98 +122,26 @@ var PercentInteractiveController = /** @class */ (function (_super) {
114
122
  var _a;
115
123
  var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.deref();
116
124
  if (owner) {
117
- if (!this.added) {
118
- this.added = true;
119
- for (var _i = 0, _b = owner.sharedElements.presented; _i < _b.length; _i++) {
120
- var p = _b[_i];
121
- p.view.opacity = 0;
122
- }
123
- for (var _c = 0, _d = owner.sharedElements.presenting; _c < _d.length; _c++) {
124
- var p = _d[_c];
125
- p.snapshot.alpha = p.endOpacity;
126
- this.transitionContext.containerView.addSubview(p.snapshot);
127
- }
128
- var state = SharedTransition.getState(owner.id);
129
- var props_1 = state.fromPageEnd;
130
- this.backgroundAnimation = UIViewPropertyAnimator.alloc().initWithDurationDampingRatioAnimations(1, 1, function () {
131
- for (var _i = 0, _a = owner.sharedElements.presenting; _i < _a.length; _i++) {
132
- var p = _a[_i];
133
- p.snapshot.frame = p.startFrame;
134
- iOSNativeHelper.copyLayerProperties(p.snapshot, p.view.ios);
135
- p.snapshot.alpha = 1;
136
- }
137
- owner.presented.view.alpha = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.opacity) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.opacity : 0;
138
- var endX = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.x) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.x : Screen.mainScreen.widthDIPs;
139
- var endY = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.y) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.y : 0;
140
- var endWidth = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.width) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.width : Screen.mainScreen.widthDIPs;
141
- var endHeight = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.height) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.height : Screen.mainScreen.heightDIPs;
142
- owner.presented.view.frame = CGRectMake(endX, endY, endWidth, endHeight);
143
- });
144
- }
145
- this.backgroundAnimation.fractionComplete = percentComplete;
125
+ var state = SharedTransition.getState(owner.id);
126
+ SharedTransitionHelper.interactiveUpdate(state, this.interactiveState, 'page', percentComplete);
146
127
  }
147
128
  };
148
129
  PercentInteractiveController.prototype.cancelInteractiveTransition = function () {
149
- var _this = this;
150
- var _a, _b, _c;
130
+ var _a;
151
131
  // console.log('cancelInteractiveTransition');
152
132
  var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.deref();
153
- if (owner && this.added) {
133
+ if (owner) {
154
134
  var state = SharedTransition.getState(owner.id);
155
- if (!state) {
156
- return;
157
- }
158
- if (this.backgroundAnimation) {
159
- this.backgroundAnimation.reversed = true;
160
- var duration = isNumber((_b = state.toPageStart) === null || _b === void 0 ? void 0 : _b.duration) ? ((_c = state.toPageStart) === null || _c === void 0 ? void 0 : _c.duration) / 1000 : 0.35;
161
- this.backgroundAnimation.continueAnimationWithTimingParametersDurationFactor(null, duration);
162
- setTimeout(function () {
163
- for (var _i = 0, _a = owner.sharedElements.presented; _i < _a.length; _i++) {
164
- var p = _a[_i];
165
- p.view.opacity = 1;
166
- }
167
- for (var _b = 0, _c = owner.sharedElements.presenting; _b < _c.length; _b++) {
168
- var p = _c[_b];
169
- p.snapshot.removeFromSuperview();
170
- }
171
- owner.presented.view.alpha = 1;
172
- _this.backgroundAnimation = null;
173
- _this.added = false;
174
- _this.transitionContext.cancelInteractiveTransition();
175
- _this.transitionContext.completeTransition(false);
176
- }, duration * 1000);
177
- }
135
+ SharedTransitionHelper.interactiveCancel(state, this.interactiveState, 'page');
178
136
  }
179
137
  };
180
138
  PercentInteractiveController.prototype.finishInteractiveTransition = function () {
181
- var _this = this;
182
- var _a, _b, _c;
139
+ var _a;
183
140
  // console.log('finishInteractiveTransition');
184
141
  var owner = (_a = this.owner) === null || _a === void 0 ? void 0 : _a.deref();
185
- if (owner && this.added) {
186
- if (this.backgroundAnimation) {
187
- this.backgroundAnimation.reversed = false;
188
- var state = SharedTransition.getState(owner.id);
189
- if (!state) {
190
- SharedTransition.finishState(owner.id);
191
- this.transitionContext.completeTransition(true);
192
- return;
193
- }
194
- var duration = isNumber((_b = state.fromPageEnd) === null || _b === void 0 ? void 0 : _b.duration) ? ((_c = state.fromPageEnd) === null || _c === void 0 ? void 0 : _c.duration) / 1000 : 0.35;
195
- this.backgroundAnimation.continueAnimationWithTimingParametersDurationFactor(null, duration);
196
- setTimeout(function () {
197
- for (var _i = 0, _a = owner.sharedElements.presenting; _i < _a.length; _i++) {
198
- var presenting = _a[_i];
199
- presenting.view.opacity = presenting.startOpacity;
200
- presenting.snapshot.removeFromSuperview();
201
- }
202
- SharedTransition.finishState(owner.id);
203
- _this.backgroundAnimation = null;
204
- _this.added = false;
205
- _this.transitionContext.finishInteractiveTransition();
206
- _this.transitionContext.completeTransition(true);
207
- }, duration * 1000);
208
- }
142
+ if (owner) {
143
+ var state = SharedTransition.getState(owner.id);
144
+ SharedTransitionHelper.interactiveFinish(state, this.interactiveState, 'page');
209
145
  }
210
146
  };
211
147
  PercentInteractiveController.ObjCProtocols = [UIViewControllerInteractiveTransitioning];
@@ -232,255 +168,11 @@ var PageTransitionController = /** @class */ (function (_super) {
232
168
  var owner = this.owner.deref();
233
169
  if (owner) {
234
170
  // console.log('--- PageTransitionController animateTransition');
235
- // console.log('owner.presented:', owner.presented);
236
- // console.log('owner.presenting:', owner.presenting);
237
- // console.log('owner.id:', owner.id);
238
- var state_1 = SharedTransition.getState(owner.id);
239
- if (!state_1) {
171
+ var state = SharedTransition.getState(owner.id);
172
+ if (!state) {
240
173
  return;
241
174
  }
242
- // console.log('state.activeType:', state.activeType);
243
- // console.log('operation:', owner.operation);
244
- // switch (state.activeType) {
245
- switch (owner.operation) {
246
- case UINavigationControllerOperation.Push: {
247
- // console.log('pushing!!');
248
- // this.presented = toViewCtrl;
249
- // this.presenting = fromViewCtrl;
250
- transitionContext.containerView.insertSubviewAboveSubview(owner.presented.view, owner.presenting.view);
251
- owner.presented.view.layoutIfNeeded();
252
- var _a = SharedTransition.getSharedElements(state_1.page, state_1.toPage), sharedElements = _a.sharedElements, presented = _a.presented;
253
- if (SharedTransition.DEBUG) {
254
- console.log(' PageTransition: Push');
255
- console.log("1. Found sharedTransitionTags to animate:", sharedElements.map(function (v) { return v.sharedTransitionTag; }));
256
- console.log("2. Take snapshots of shared elements and position them based on presenting view:");
257
- }
258
- var _loop_1 = function (presentingView) {
259
- if (!owner.sharedElements) {
260
- owner.sharedElements = {
261
- presented: [],
262
- presenting: [],
263
- };
264
- }
265
- var presentingSharedElement = presentingView.ios;
266
- // TODO: discuss whether we should check if UIImage/UIImageView type to always snapshot images or if other view types could be duped/added vs. snapshotted
267
- // Note: snapshot may be most efficient/simple
268
- // console.log('---> ', presentingView.sharedTransitionTag, ': ', presentingSharedElement)
269
- var presentedView = presented.find(function (v) { return v.sharedTransitionTag === presentingView.sharedTransitionTag; });
270
- var presentedSharedElement = presentedView.ios;
271
- var sharedElementSnapshot = UIImageView.alloc().init(); // WithImage(snapshotView(presentedSharedElement));
272
- // treat images differently...
273
- if (presentedSharedElement instanceof UIImageView) {
274
- // in case the image is loaded async, we need to update the snapshot when it changes
275
- // todo: remove listener on transition end
276
- presentedView.on('imageSourceChange', function () {
277
- sharedElementSnapshot.image = iOSNativeHelper.snapshotView(presentedSharedElement, Screen.mainScreen.scale);
278
- sharedElementSnapshot.tintColor = presentedSharedElement.tintColor;
279
- });
280
- sharedElementSnapshot.tintColor = presentedSharedElement.tintColor;
281
- sharedElementSnapshot.contentMode = presentedSharedElement.contentMode;
282
- }
283
- iOSNativeHelper.copyLayerProperties(sharedElementSnapshot, presentingSharedElement);
284
- sharedElementSnapshot.clipsToBounds = true;
285
- // console.log('---> snapshot: ', sharedElementSnapshot);
286
- var startFrame = presentingSharedElement.convertRectToView(presentingSharedElement.bounds, transitionContext.containerView);
287
- var endFrame = presentedSharedElement.convertRectToView(presentedSharedElement.bounds, transitionContext.containerView);
288
- sharedElementSnapshot.frame = startFrame;
289
- if (SharedTransition.DEBUG) {
290
- console.log('---> ', presentingView.sharedTransitionTag, ' frame:', iOSNativeHelper.printCGRect(sharedElementSnapshot.frame));
291
- }
292
- owner.sharedElements.presenting.push({
293
- view: presentingView,
294
- startFrame: startFrame,
295
- endFrame: endFrame,
296
- snapshot: sharedElementSnapshot,
297
- startOpacity: presentingView.opacity,
298
- endOpacity: presentedView.opacity,
299
- });
300
- owner.sharedElements.presented.push({
301
- view: presentedView,
302
- startFrame: endFrame,
303
- endFrame: startFrame,
304
- startOpacity: presentedView.opacity,
305
- endOpacity: presentingView.opacity,
306
- });
307
- // set initial opacity to match the source view opacity
308
- sharedElementSnapshot.alpha = presentingView.opacity;
309
- // hide both while animating within the transition context
310
- presentingView.opacity = 0;
311
- presentedView.opacity = 0;
312
- // add snapshot to animate
313
- transitionContext.containerView.addSubview(sharedElementSnapshot);
314
- };
315
- for (var _i = 0, sharedElements_1 = sharedElements; _i < sharedElements_1.length; _i++) {
316
- var presentingView = sharedElements_1[_i];
317
- _loop_1(presentingView);
318
- }
319
- var cleanupPresent_1 = function () {
320
- for (var _i = 0, _a = owner.sharedElements.presented; _i < _a.length; _i++) {
321
- var presented_1 = _a[_i];
322
- presented_1.view.opacity = presented_1.startOpacity;
323
- }
324
- for (var _b = 0, _c = owner.sharedElements.presenting; _b < _c.length; _b++) {
325
- var presenting = _c[_b];
326
- presenting.snapshot.removeFromSuperview();
327
- }
328
- SharedTransition.updateState(owner.id, {
329
- activeType: SharedTransitionAnimationType.dismiss,
330
- });
331
- owner.presenting.view.removeFromSuperview();
332
- transitionContext.completeTransition(true);
333
- };
334
- var updateFramePresent_1 = function () {
335
- // https://stackoverflow.com/a/27997678/1418981
336
- // In order to have proper layout. Seems mostly needed when presenting.
337
- // For instance during presentation, destination view doesn't account navigation bar height.
338
- // Not sure if best to leave all the time?
339
- // owner.presented.view.setNeedsLayout();
340
- // owner.presented.view.layoutIfNeeded();
341
- if (SharedTransition.DEBUG) {
342
- console.log('3. Animating shared elements:');
343
- }
344
- var _loop_2 = function (presented_2) {
345
- var presentingMatch = owner.sharedElements.presenting.find(function (v) { return v.view.sharedTransitionTag === presented_2.view.sharedTransitionTag; });
346
- // Workaround wrong origin due ongoing layout process.
347
- var updatedEndFrame = presented_2.view.ios.convertRectToView(presented_2.view.ios.bounds, transitionContext.containerView);
348
- var correctedEndFrame = CGRectMake(updatedEndFrame.origin.x, updatedEndFrame.origin.y, presentingMatch.endFrame.size.width, presentingMatch.endFrame.size.height);
349
- presentingMatch.snapshot.frame = correctedEndFrame;
350
- // apply view and layer properties to the snapshot view to match the source/presented view
351
- iOSNativeHelper.copyLayerProperties(presentingMatch.snapshot, presented_2.view.ios);
352
- // create a snapshot of the presented view
353
- presentingMatch.snapshot.image = iOSNativeHelper.snapshotView(presented_2.view.ios, Screen.mainScreen.scale);
354
- // apply correct alpha
355
- presentingMatch.snapshot.alpha = presentingMatch.endOpacity;
356
- if (SharedTransition.DEBUG) {
357
- console.log("---> ".concat(presentingMatch.view.sharedTransitionTag, " animate to: "), iOSNativeHelper.printCGRect(correctedEndFrame));
358
- }
359
- };
360
- for (var _i = 0, _a = owner.sharedElements.presented; _i < _a.length; _i++) {
361
- var presented_2 = _a[_i];
362
- _loop_2(presented_2);
363
- }
364
- };
365
- // starting page properties
366
- var toProps = state_1.toPageStart;
367
- owner.presented.view.alpha = isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.opacity) ? toProps === null || toProps === void 0 ? void 0 : toProps.opacity : 0;
368
- var startX = isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.x) ? toProps === null || toProps === void 0 ? void 0 : toProps.x : Screen.mainScreen.widthDIPs;
369
- var startY = isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.y) ? toProps === null || toProps === void 0 ? void 0 : toProps.y : 0;
370
- var startWidth = isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.width) ? toProps === null || toProps === void 0 ? void 0 : toProps.width : Screen.mainScreen.widthDIPs;
371
- var startHeight = isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.height) ? toProps === null || toProps === void 0 ? void 0 : toProps.height : Screen.mainScreen.heightDIPs;
372
- owner.presented.view.frame = CGRectMake(startX, startY, startWidth, startHeight);
373
- var animateProperties_1 = function () {
374
- var props = state_1.toPageEnd;
375
- // animate page properties to the following:
376
- owner.presented.view.alpha = isNumber(props === null || props === void 0 ? void 0 : props.opacity) ? props === null || props === void 0 ? void 0 : props.opacity : 1;
377
- var endX = isNumber(props === null || props === void 0 ? void 0 : props.x) ? props === null || props === void 0 ? void 0 : props.x : 0;
378
- var endY = isNumber(props === null || props === void 0 ? void 0 : props.y) ? props === null || props === void 0 ? void 0 : props.y : 0;
379
- var endWidth = isNumber(props === null || props === void 0 ? void 0 : props.width) ? props === null || props === void 0 ? void 0 : props.width : Screen.mainScreen.widthDIPs;
380
- var endHeight = isNumber(props === null || props === void 0 ? void 0 : props.height) ? props === null || props === void 0 ? void 0 : props.height : Screen.mainScreen.heightDIPs;
381
- owner.presented.view.frame = CGRectMake(endX, endY, endWidth, endHeight);
382
- };
383
- if (isNumber(toProps === null || toProps === void 0 ? void 0 : toProps.duration)) {
384
- // override spring and use only linear animation
385
- UIView.animateWithDurationAnimationsCompletion((toProps === null || toProps === void 0 ? void 0 : toProps.duration) / 1000, function () {
386
- animateProperties_1();
387
- updateFramePresent_1();
388
- }, function () {
389
- cleanupPresent_1();
390
- });
391
- }
392
- else {
393
- var spring = toProps === null || toProps === void 0 ? void 0 : toProps.spring;
394
- iOSNativeHelper.animateWithSpring({
395
- tension: isNumber(spring === null || spring === void 0 ? void 0 : spring.tension) ? spring === null || spring === void 0 ? void 0 : spring.tension : DEFAULT_SPRING.tension,
396
- friction: isNumber(spring === null || spring === void 0 ? void 0 : spring.friction) ? spring === null || spring === void 0 ? void 0 : spring.tension : DEFAULT_SPRING.friction,
397
- animations: function () {
398
- animateProperties_1();
399
- updateFramePresent_1();
400
- },
401
- completion: function () {
402
- cleanupPresent_1();
403
- },
404
- });
405
- }
406
- break;
407
- }
408
- case UINavigationControllerOperation.Pop: {
409
- // console.log('popping!');
410
- transitionContext.containerView.insertSubviewBelowSubview(owner.presenting.view, owner.presented.view);
411
- // console.log('transitionContext.containerView.subviews.count:', transitionContext.containerView.subviews.count);
412
- if (SharedTransition.DEBUG) {
413
- console.log(' PageTransition: Pop');
414
- console.log("1. Dismiss sharedTransitionTags to animate:", owner.sharedElements.presented.map(function (p) { return p.view.sharedTransitionTag; }));
415
- console.log("2. Add back previously stored sharedElements to dismiss:");
416
- }
417
- for (var _b = 0, _c = owner.sharedElements.presented; _b < _c.length; _b++) {
418
- var p = _c[_b];
419
- p.view.opacity = 0;
420
- }
421
- for (var _d = 0, _e = owner.sharedElements.presenting; _d < _e.length; _d++) {
422
- var p = _e[_d];
423
- p.snapshot.alpha = p.endOpacity;
424
- transitionContext.containerView.addSubview(p.snapshot);
425
- }
426
- var cleanupDismiss_1 = function () {
427
- for (var _i = 0, _a = owner.sharedElements.presenting; _i < _a.length; _i++) {
428
- var presenting = _a[_i];
429
- presenting.view.opacity = presenting.startOpacity;
430
- presenting.snapshot.removeFromSuperview();
431
- }
432
- SharedTransition.finishState(owner.id);
433
- transitionContext.completeTransition(true);
434
- };
435
- var updateFrameDismiss_1 = function () {
436
- if (SharedTransition.DEBUG) {
437
- console.log('3. Dismissing shared elements:');
438
- }
439
- for (var _i = 0, _a = owner.sharedElements.presenting; _i < _a.length; _i++) {
440
- var presenting = _a[_i];
441
- iOSNativeHelper.copyLayerProperties(presenting.snapshot, presenting.view.ios);
442
- presenting.snapshot.frame = presenting.startFrame;
443
- presenting.snapshot.alpha = presenting.startOpacity;
444
- if (SharedTransition.DEBUG) {
445
- console.log("---> ".concat(presenting.view.sharedTransitionTag, " animate to: "), iOSNativeHelper.printCGRect(presenting.startFrame));
446
- }
447
- }
448
- };
449
- var props_1 = state_1.fromPageEnd;
450
- var animateProperties_2 = function () {
451
- owner.presented.view.alpha = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.opacity) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.opacity : 0;
452
- var endX = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.x) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.x : Screen.mainScreen.widthDIPs;
453
- var endY = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.y) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.y : 0;
454
- var endWidth = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.width) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.width : Screen.mainScreen.widthDIPs;
455
- var endHeight = isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.height) ? props_1 === null || props_1 === void 0 ? void 0 : props_1.height : Screen.mainScreen.heightDIPs;
456
- owner.presented.view.frame = CGRectMake(endX, endY, endWidth, endHeight);
457
- };
458
- if (isNumber(props_1 === null || props_1 === void 0 ? void 0 : props_1.duration)) {
459
- // override spring and use only linear animation
460
- UIView.animateWithDurationAnimationsCompletion((props_1 === null || props_1 === void 0 ? void 0 : props_1.duration) / 1000, function () {
461
- animateProperties_2();
462
- updateFrameDismiss_1();
463
- }, function () {
464
- cleanupDismiss_1();
465
- });
466
- }
467
- else {
468
- var spring = props_1 === null || props_1 === void 0 ? void 0 : props_1.spring;
469
- iOSNativeHelper.animateWithSpring({
470
- tension: isNumber(spring === null || spring === void 0 ? void 0 : spring.tension) ? spring === null || spring === void 0 ? void 0 : spring.tension : DEFAULT_SPRING.tension,
471
- friction: isNumber(spring === null || spring === void 0 ? void 0 : spring.friction) ? spring === null || spring === void 0 ? void 0 : spring.tension : DEFAULT_SPRING.friction,
472
- animations: function () {
473
- animateProperties_2();
474
- updateFrameDismiss_1();
475
- },
476
- completion: function () {
477
- cleanupDismiss_1();
478
- },
479
- });
480
- }
481
- break;
482
- }
483
- }
175
+ SharedTransitionHelper.animate(state, transitionContext, 'page');
484
176
  }
485
177
  };
486
178
  PageTransitionController.ObjCProtocols = [UIViewControllerAnimatedTransitioning];
@@ -1 +1 @@
1
- {"version":3,"file":"page-transition.ios.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/page-transition.ios.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAuB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAe7C,sBAAsB,CAAC,oBAA4C,EAAE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MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC;wBAChI,IAAI,OAAO,GAAG,eAAe,EAAE;4BAC9B,IAAI,IAAI,CAAC,2BAA2B,EAAE;gCACrC,IAAI,CAAC,2BAA2B,EAAE,CAAC;gCACnC,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;6BACxC;4BACD,IAAI,CAAC,qBAAqB,CAAC,2BAA2B,EAAE,CAAC;yBACzD;6BAAM;4BACN,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE;gCACrC,oBAAoB,EAAE,IAAI;6BAC1B,CAAC,CAAC;4BACH,IAAI,CAAC,qBAAqB,CAAC,2BAA2B,EAAE,CAAC;yBACzD;qBACD;oBACD,MAAM;aACP;SACD;IACF,CAAC;CACD"}
1
+ {"version":3,"file":"page-transition.ios.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/page-transition.ios.ts"],"names":[],"mappings":"AACA,OAAO,EAAiD,UAAU,EAAE,MAAM,GAAG,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAuB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAiC,gBAAgB,EAAiE,MAAM,qBAAqB,CAAC;AACvK,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,OAAO,cAAe,SAAQ,UAAU;IAiB7C,sBAAsB,CAAC,oBAA4C,EAAE,SAAiB,EAAE,MAAwB,EAAE,IAAsB;QACvI,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;Y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oBAC3B,IAAI,IAAI,CAAC,qBAAqB,EAAE;wBAC/B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC;wBAChI,IAAI,OAAO,GAAG,eAAe,EAAE;4BAC9B,IAAI,IAAI,CAAC,2BAA2B,EAAE;gCACrC,IAAI,CAAC,2BAA2B,EAAE,CAAC;gCACnC,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;6BACxC;4BACD,IAAI,CAAC,qBAAqB,CAAC,2BAA2B,EAAE,CAAC;yBACzD;6BAAM;4BACN,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE;gCACrC,oBAAoB,EAAE,IAAI;6BAC1B,CAAC,CAAC;4BACH,IAAI,CAAC,qBAAqB,CAAC,2BAA2B,EAAE,CAAC;yBACzD;qBACD;oBACD,MAAM;aACP;SACD;IACF,CAAC;CACD"}
@@ -0,0 +1,4 @@
1
+ import { SharedTransitionState } from './shared-transition';
2
+ export declare class SharedTransitionHelper {
3
+ static animate(state: SharedTransitionState, transitionContext: any, type: 'page' | 'modal'): void;
4
+ }
@@ -0,0 +1,6 @@
1
+ export class SharedTransitionHelper {
2
+ static animate(state, transitionContext, type) {
3
+ // may be able to consolidate android handling here in future
4
+ }
5
+ }
6
+ //# sourceMappingURL=shared-transition-helper.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-transition-helper.android.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/shared-transition-helper.android.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,sBAAsB;IAClC,MAAM,CAAC,OAAO,CAAC,KAA4B,EAAE,iBAAsB,EAAE,IAAsB;QAC1F,6DAA6D;IAC9D,CAAC;CACD"}
@@ -0,0 +1,10 @@
1
+ import type { SharedTransitionType, SharedInteractiveState } from '.';
2
+ import type { SharedTransitionState } from './shared-transition';
3
+
4
+ export declare class SharedTransitionHelper {
5
+ static animate(state: SharedTransitionState, transitionContext: any /* iOS: UIViewControllerContextTransitioning */, type: SharedTransitionType): void;
6
+ static interactiveStart(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
7
+ static interactiveUpdate(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType, percent: number): void;
8
+ static interactiveCancel(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
9
+ static interactiveFinish(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { SharedInteractiveState, SharedTransitionType } from '.';
2
+ import { SharedTransitionState } from './shared-transition';
3
+ export declare class SharedTransitionHelper {
4
+ static animate(state: SharedTransitionState, transitionContext: UIViewControllerContextTransitioning, type: SharedTransitionType): void;
5
+ static interactiveStart(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
6
+ static interactiveUpdate(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType, percent: number): void;
7
+ static interactiveCancel(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
8
+ static interactiveFinish(state: SharedTransitionState, interactiveState: SharedInteractiveState, type: SharedTransitionType): void;
9
+ }