@ionic/react 7.4.4-dev.11696956070.1faa3cfe → 7.4.4-dev.11699471770.1b7273c4
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.
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useRef, useEffect, createElement, useState, useMemo, Fragment, useCallback } from 'react';
|
|
2
2
|
import { isPlatform as isPlatform$1, getPlatforms as getPlatforms$1, componentOnReady, createAnimation, actionSheetController, alertController, toastController, modalController, popoverController, pickerController, loadingController, initialize } from '@ionic/core/components';
|
|
3
|
-
export { IonicSafeString, IonicSlides, createAnimation, createGesture, getIonPageElement, getTimeGivenProgression, iosTransitionAnimation, mdTransitionAnimation } from '@ionic/core/components';
|
|
3
|
+
export { IonicSafeString, IonicSlides, createAnimation, createGesture, getIonPageElement, getTimeGivenProgression, iosTransitionAnimation, mdTransitionAnimation, openURL } from '@ionic/core/components';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
6
6
|
import { defineCustomElement as defineCustomElement$1 } from '@ionic/core/components/ion-accordion.js';
|
|
@@ -113,18 +113,6 @@ const IonLifeCycleContext = /*@__PURE__*/ React.createContext({
|
|
|
113
113
|
ionViewDidLeave: () => {
|
|
114
114
|
return;
|
|
115
115
|
},
|
|
116
|
-
cleanupIonViewWillEnter: () => {
|
|
117
|
-
return;
|
|
118
|
-
},
|
|
119
|
-
cleanupIonViewDidEnter: () => {
|
|
120
|
-
return;
|
|
121
|
-
},
|
|
122
|
-
cleanupIonViewWillLeave: () => {
|
|
123
|
-
return;
|
|
124
|
-
},
|
|
125
|
-
cleanupIonViewDidLeave: () => {
|
|
126
|
-
return;
|
|
127
|
-
},
|
|
128
116
|
});
|
|
129
117
|
const DefaultIonLifeCycleContext = class {
|
|
130
118
|
constructor() {
|
|
@@ -132,10 +120,6 @@ const DefaultIonLifeCycleContext = class {
|
|
|
132
120
|
this.ionViewDidEnterCallbacks = [];
|
|
133
121
|
this.ionViewWillLeaveCallbacks = [];
|
|
134
122
|
this.ionViewDidLeaveCallbacks = [];
|
|
135
|
-
this.ionViewWillEnterDestructorCallbacks = [];
|
|
136
|
-
this.ionViewDidEnterDestructorCallbacks = [];
|
|
137
|
-
this.ionViewWillLeaveDestructorCallbacks = [];
|
|
138
|
-
this.ionViewDidLeaveDestructorCallbacks = [];
|
|
139
123
|
}
|
|
140
124
|
onIonViewWillEnter(callback) {
|
|
141
125
|
if (callback.id) {
|
|
@@ -151,59 +135,8 @@ const DefaultIonLifeCycleContext = class {
|
|
|
151
135
|
this.ionViewWillEnterCallbacks.push(callback);
|
|
152
136
|
}
|
|
153
137
|
}
|
|
154
|
-
teardownCallback(callback, callbacks) {
|
|
155
|
-
// Find any destructors that have been registered for the callback
|
|
156
|
-
const matches = callbacks.filter((x) => x.id === callback.id);
|
|
157
|
-
if (matches.length !== 0) {
|
|
158
|
-
// Execute the destructor for each matching item
|
|
159
|
-
matches.forEach((match) => {
|
|
160
|
-
if (match && typeof match.destructor === 'function') {
|
|
161
|
-
match.destructor();
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
// Remove all matching items from the array
|
|
165
|
-
callbacks = callbacks.filter((x) => x.id !== callback.id);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Tears down the user-provided ionViewWillEnter lifecycle callback.
|
|
170
|
-
* This is the same behavior as React's useEffect hook. The callback
|
|
171
|
-
* is invoked when the component is unmounted.
|
|
172
|
-
*/
|
|
173
|
-
cleanupIonViewWillEnter(callback) {
|
|
174
|
-
this.teardownCallback(callback, this.ionViewWillEnterDestructorCallbacks);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Tears down the user-provided ionViewDidEnter lifecycle callback.
|
|
178
|
-
* This is the same behavior as React's useEffect hook. The callback
|
|
179
|
-
* is invoked when the component is unmounted.
|
|
180
|
-
*/
|
|
181
|
-
cleanupIonViewDidEnter(callback) {
|
|
182
|
-
this.teardownCallback(callback, this.ionViewDidEnterDestructorCallbacks);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Tears down the user-provided ionViewWillLeave lifecycle callback.
|
|
186
|
-
* This is the same behavior as React's useEffect hook. The callback
|
|
187
|
-
* is invoked when the component is unmounted.
|
|
188
|
-
*/
|
|
189
|
-
cleanupIonViewWillLeave(callback) {
|
|
190
|
-
this.teardownCallback(callback, this.ionViewWillLeaveDestructorCallbacks);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Tears down the user-provided ionViewDidLeave lifecycle callback.
|
|
194
|
-
* This is the same behavior as React's useEffect hook. The callback
|
|
195
|
-
* is invoked when the component is unmounted.
|
|
196
|
-
*/
|
|
197
|
-
cleanupIonViewDidLeave(callback) {
|
|
198
|
-
this.teardownCallback(callback, this.ionViewDidLeaveDestructorCallbacks);
|
|
199
|
-
}
|
|
200
138
|
ionViewWillEnter() {
|
|
201
|
-
this.ionViewWillEnterCallbacks.forEach((cb) =>
|
|
202
|
-
const destructor = cb();
|
|
203
|
-
if (cb.id) {
|
|
204
|
-
this.ionViewWillEnterDestructorCallbacks.push({ id: cb.id, destructor });
|
|
205
|
-
}
|
|
206
|
-
});
|
|
139
|
+
this.ionViewWillEnterCallbacks.forEach((cb) => cb());
|
|
207
140
|
}
|
|
208
141
|
onIonViewDidEnter(callback) {
|
|
209
142
|
if (callback.id) {
|
|
@@ -220,12 +153,7 @@ const DefaultIonLifeCycleContext = class {
|
|
|
220
153
|
}
|
|
221
154
|
}
|
|
222
155
|
ionViewDidEnter() {
|
|
223
|
-
this.ionViewDidEnterCallbacks.forEach((cb) =>
|
|
224
|
-
const destructor = cb();
|
|
225
|
-
if (cb.id) {
|
|
226
|
-
this.ionViewDidEnterDestructorCallbacks.push({ id: cb.id, destructor });
|
|
227
|
-
}
|
|
228
|
-
});
|
|
156
|
+
this.ionViewDidEnterCallbacks.forEach((cb) => cb());
|
|
229
157
|
}
|
|
230
158
|
onIonViewWillLeave(callback) {
|
|
231
159
|
if (callback.id) {
|
|
@@ -242,12 +170,7 @@ const DefaultIonLifeCycleContext = class {
|
|
|
242
170
|
}
|
|
243
171
|
}
|
|
244
172
|
ionViewWillLeave() {
|
|
245
|
-
this.ionViewWillLeaveCallbacks.forEach((cb) =>
|
|
246
|
-
const destructor = cb();
|
|
247
|
-
if (cb.id) {
|
|
248
|
-
this.ionViewWillLeaveDestructorCallbacks.push({ id: cb.id, destructor });
|
|
249
|
-
}
|
|
250
|
-
});
|
|
173
|
+
this.ionViewWillLeaveCallbacks.forEach((cb) => cb());
|
|
251
174
|
}
|
|
252
175
|
onIonViewDidLeave(callback) {
|
|
253
176
|
if (callback.id) {
|
|
@@ -264,12 +187,7 @@ const DefaultIonLifeCycleContext = class {
|
|
|
264
187
|
}
|
|
265
188
|
}
|
|
266
189
|
ionViewDidLeave() {
|
|
267
|
-
this.ionViewDidLeaveCallbacks.forEach((cb) =>
|
|
268
|
-
const destructor = cb();
|
|
269
|
-
if (cb.id) {
|
|
270
|
-
this.ionViewDidLeaveDestructorCallbacks.push({ id: cb.id, destructor });
|
|
271
|
-
}
|
|
272
|
-
});
|
|
190
|
+
this.ionViewDidLeaveCallbacks.forEach((cb) => cb());
|
|
273
191
|
this.componentCanBeDestroyed();
|
|
274
192
|
}
|
|
275
193
|
onComponentCanBeDestroyed(callback) {
|
|
@@ -328,9 +246,6 @@ const useIonViewWillEnter = (callback, deps = []) => {
|
|
|
328
246
|
useEffect(() => {
|
|
329
247
|
callback.id = id.current;
|
|
330
248
|
context.onIonViewWillEnter(callback);
|
|
331
|
-
return () => {
|
|
332
|
-
context.cleanupIonViewWillEnter(callback);
|
|
333
|
-
};
|
|
334
249
|
}, deps);
|
|
335
250
|
};
|
|
336
251
|
const useIonViewDidEnter = (callback, deps = []) => {
|
|
@@ -340,9 +255,6 @@ const useIonViewDidEnter = (callback, deps = []) => {
|
|
|
340
255
|
useEffect(() => {
|
|
341
256
|
callback.id = id.current;
|
|
342
257
|
context.onIonViewDidEnter(callback);
|
|
343
|
-
return () => {
|
|
344
|
-
context.cleanupIonViewDidEnter(callback);
|
|
345
|
-
};
|
|
346
258
|
}, deps);
|
|
347
259
|
};
|
|
348
260
|
const useIonViewWillLeave = (callback, deps = []) => {
|
|
@@ -352,9 +264,6 @@ const useIonViewWillLeave = (callback, deps = []) => {
|
|
|
352
264
|
useEffect(() => {
|
|
353
265
|
callback.id = id.current;
|
|
354
266
|
context.onIonViewWillLeave(callback);
|
|
355
|
-
return () => {
|
|
356
|
-
context.cleanupIonViewWillLeave(callback);
|
|
357
|
-
};
|
|
358
267
|
}, deps);
|
|
359
268
|
};
|
|
360
269
|
const useIonViewDidLeave = (callback, deps = []) => {
|
|
@@ -364,9 +273,6 @@ const useIonViewDidLeave = (callback, deps = []) => {
|
|
|
364
273
|
useEffect(() => {
|
|
365
274
|
callback.id = id.current;
|
|
366
275
|
context.onIonViewDidLeave(callback);
|
|
367
|
-
return () => {
|
|
368
|
-
context.cleanupIonViewDidLeave(callback);
|
|
369
|
-
};
|
|
370
276
|
}, deps);
|
|
371
277
|
};
|
|
372
278
|
|
|
@@ -1114,16 +1020,6 @@ class PageManager extends React.PureComponent {
|
|
|
1114
1020
|
this.ionPageElementRef = React.createRef();
|
|
1115
1021
|
// React refs must be stable (not created inline).
|
|
1116
1022
|
this.stableMergedRefs = mergeRefs(this.ionPageElementRef, this.props.forwardedRef);
|
|
1117
|
-
/**
|
|
1118
|
-
* This binds the scope of the following methods to the class scope.
|
|
1119
|
-
* The `.bind` method returns a new function, so we need to assign it
|
|
1120
|
-
* in the constructor to avoid creating a new function when removing the
|
|
1121
|
-
* event listeners.
|
|
1122
|
-
*/
|
|
1123
|
-
this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
|
|
1124
|
-
this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
|
|
1125
|
-
this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
|
|
1126
|
-
this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
|
|
1127
1023
|
}
|
|
1128
1024
|
componentDidMount() {
|
|
1129
1025
|
if (this.ionPageElementRef.current) {
|
|
@@ -1131,18 +1027,18 @@ class PageManager extends React.PureComponent {
|
|
|
1131
1027
|
this.ionPageElementRef.current.classList.add('ion-page-invisible');
|
|
1132
1028
|
}
|
|
1133
1029
|
this.context.registerIonPage(this.ionPageElementRef.current, this.props.routeInfo);
|
|
1134
|
-
this.ionPageElementRef.current.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
|
|
1135
|
-
this.ionPageElementRef.current.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
|
|
1136
|
-
this.ionPageElementRef.current.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
|
|
1137
|
-
this.ionPageElementRef.current.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
|
|
1030
|
+
this.ionPageElementRef.current.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler.bind(this));
|
|
1031
|
+
this.ionPageElementRef.current.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler.bind(this));
|
|
1032
|
+
this.ionPageElementRef.current.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler.bind(this));
|
|
1033
|
+
this.ionPageElementRef.current.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler.bind(this));
|
|
1138
1034
|
}
|
|
1139
1035
|
}
|
|
1140
1036
|
componentWillUnmount() {
|
|
1141
1037
|
if (this.ionPageElementRef.current) {
|
|
1142
|
-
this.ionPageElementRef.current.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
|
|
1143
|
-
this.ionPageElementRef.current.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
|
|
1144
|
-
this.ionPageElementRef.current.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
|
|
1145
|
-
this.ionPageElementRef.current.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
|
|
1038
|
+
this.ionPageElementRef.current.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler.bind(this));
|
|
1039
|
+
this.ionPageElementRef.current.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler.bind(this));
|
|
1040
|
+
this.ionPageElementRef.current.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler.bind(this));
|
|
1041
|
+
this.ionPageElementRef.current.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler.bind(this));
|
|
1146
1042
|
}
|
|
1147
1043
|
}
|
|
1148
1044
|
ionViewWillEnterHandler() {
|
|
@@ -1251,16 +1147,6 @@ class OutletPageManager extends React.Component {
|
|
|
1251
1147
|
constructor(props) {
|
|
1252
1148
|
super(props);
|
|
1253
1149
|
this.outletIsReady = false;
|
|
1254
|
-
/**
|
|
1255
|
-
* This binds the scope of the following methods to the class scope.
|
|
1256
|
-
* The `.bind` method returns a new function, so we need to assign it
|
|
1257
|
-
* in the constructor to avoid creating a new function when removing the
|
|
1258
|
-
* event listeners.
|
|
1259
|
-
*/
|
|
1260
|
-
this.ionViewWillEnterHandler = this.ionViewWillEnterHandler.bind(this);
|
|
1261
|
-
this.ionViewDidEnterHandler = this.ionViewDidEnterHandler.bind(this);
|
|
1262
|
-
this.ionViewWillLeaveHandler = this.ionViewWillLeaveHandler.bind(this);
|
|
1263
|
-
this.ionViewDidLeaveHandler = this.ionViewDidLeaveHandler.bind(this);
|
|
1264
1150
|
}
|
|
1265
1151
|
componentDidMount() {
|
|
1266
1152
|
if (this.ionRouterOutlet) {
|
|
@@ -1274,18 +1160,18 @@ class OutletPageManager extends React.Component {
|
|
|
1274
1160
|
this.context.registerIonPage(this.ionRouterOutlet, this.props.routeInfo);
|
|
1275
1161
|
});
|
|
1276
1162
|
}
|
|
1277
|
-
this.ionRouterOutlet.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
|
|
1278
|
-
this.ionRouterOutlet.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
|
|
1279
|
-
this.ionRouterOutlet.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
|
|
1280
|
-
this.ionRouterOutlet.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
|
|
1163
|
+
this.ionRouterOutlet.addEventListener('ionViewWillEnter', this.ionViewWillEnterHandler.bind(this));
|
|
1164
|
+
this.ionRouterOutlet.addEventListener('ionViewDidEnter', this.ionViewDidEnterHandler.bind(this));
|
|
1165
|
+
this.ionRouterOutlet.addEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler.bind(this));
|
|
1166
|
+
this.ionRouterOutlet.addEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler.bind(this));
|
|
1281
1167
|
}
|
|
1282
1168
|
}
|
|
1283
1169
|
componentWillUnmount() {
|
|
1284
1170
|
if (this.ionRouterOutlet) {
|
|
1285
|
-
this.ionRouterOutlet.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler);
|
|
1286
|
-
this.ionRouterOutlet.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler);
|
|
1287
|
-
this.ionRouterOutlet.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler);
|
|
1288
|
-
this.ionRouterOutlet.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler);
|
|
1171
|
+
this.ionRouterOutlet.removeEventListener('ionViewWillEnter', this.ionViewWillEnterHandler.bind(this));
|
|
1172
|
+
this.ionRouterOutlet.removeEventListener('ionViewDidEnter', this.ionViewDidEnterHandler.bind(this));
|
|
1173
|
+
this.ionRouterOutlet.removeEventListener('ionViewWillLeave', this.ionViewWillLeaveHandler.bind(this));
|
|
1174
|
+
this.ionRouterOutlet.removeEventListener('ionViewDidLeave', this.ionViewDidLeaveHandler.bind(this));
|
|
1289
1175
|
}
|
|
1290
1176
|
}
|
|
1291
1177
|
ionViewWillEnterHandler() {
|