canvasframework 0.5.51 → 0.5.54

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.
@@ -55,18 +55,29 @@ class Camera extends Component {
55
55
  }
56
56
 
57
57
  async _mount() {
58
- super._mount?.();
59
-
60
- // Redémarrage auto si besoin
61
- if (this.autoStart && !this.stream && !this.isStarting) {
62
- this.isStarting = true;
63
- await this.startCamera();
64
- this.isStarting = false;
65
- }
66
-
67
- this.setupEventListeners();
58
+ super._mount?.();
59
+
60
+ // CORRECTION : Ne démarrer que si visible ET pas en navigation
61
+ if (this.visible &&
62
+ this.autoStart &&
63
+ !this.stream &&
64
+ !this.isStarting &&
65
+ !this.framework._isNavigating) {
66
+ this.isStarting = true;
67
+ await this.startCamera();
68
+ this.isStarting = false;
69
+ }
70
+
71
+ this.setupEventListeners();
68
72
  }
69
-
73
+
74
+ onUnmount() {
75
+ this.removeEventListeners();
76
+ this.stopCamera();
77
+ if (this.flashTimer) clearTimeout(this.flashTimer);
78
+ if (this.previewTimeout) clearTimeout(this.previewTimeout);
79
+ }
80
+
70
81
  destroy() {
71
82
  this.removeEventListeners();
72
83
  this.stopCamera();
@@ -57,8 +57,8 @@ class FloatedCamera extends Component {
57
57
  async _mount() {
58
58
  super._mount?.();
59
59
 
60
- // Redémarrage auto si besoin
61
- if (this.autoStart && !this.stream && !this.isStarting) {
60
+ // CORRECTION : Ne démarrer que si visible ET pas en navigation
61
+ if (this.visible && this.autoStart && !this.stream && !this.isStarting && !this.framework._isNavigating) {
62
62
  this.isStarting = true;
63
63
  await this.startCamera();
64
64
  this.isStarting = false;
@@ -66,6 +66,13 @@ class FloatedCamera extends Component {
66
66
 
67
67
  this.setupEventListeners();
68
68
  }
69
+
70
+ onUnmount() {
71
+ this.removeEventListeners();
72
+ this.stopCamera();
73
+ if (this.flashTimer) clearTimeout(this.flashTimer);
74
+ if (this.previewTimeout) clearTimeout(this.previewTimeout);
75
+ }
69
76
 
70
77
  destroy() {
71
78
  this.removeEventListeners();
@@ -2011,6 +2011,7 @@ class CanvasFramework {
2011
2011
  comp.onClick = null;
2012
2012
  comp.onPress = null;
2013
2013
 
2014
+
2014
2015
  if (comp._unmount && typeof comp._unmount === 'function') {
2015
2016
  comp._unmount();
2016
2017
  }
@@ -2039,9 +2040,13 @@ class CanvasFramework {
2039
2040
 
2040
2041
  // ===== CRÉER LES NOUVEAUX COMPOSANTS =====
2041
2042
  this.components = [];
2043
+ this._isNavigating = true; // ✅ Flag pour empêcher l'auto-démarrages
2044
+
2042
2045
  if (typeof route.component === 'function') {
2043
2046
  route.component(this, params, query);
2044
2047
  }
2048
+
2049
+ this._isNavigating = false; // ✅ Navigation terminée
2045
2050
 
2046
2051
  // ===== LANCER L'ANIMATION DE TRANSITION =====
2047
2052
  if (animate && !this.transitionState.isTransitioning) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasframework",
3
- "version": "0.5.51",
3
+ "version": "0.5.54",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/beyons/CanvasFramework.git"