aport-tools 4.0.30 → 4.0.32
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/defaults/reanimatedWrapper.d.ts +2 -0
- package/dist/index.esm.js +474 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +497 -146
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,70 +1,401 @@
|
|
1
|
-
/*! aport-tools v4.0.
|
1
|
+
/*! aport-tools v4.0.32 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
5
5
|
var reactNative = require('react-native');
|
6
6
|
var asyncStorage = require('@react-native-async-storage/async-storage');
|
7
|
-
var
|
7
|
+
var Reanimated = require('react-native-reanimated');
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
function
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
9
|
+
function _interopNamespaceDefault(e) {
|
10
|
+
var n = Object.create(null);
|
11
|
+
if (e) {
|
12
|
+
Object.keys(e).forEach(function (k) {
|
13
|
+
if (k !== 'default') {
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
16
|
+
enumerable: true,
|
17
|
+
get: function () { return e[k]; }
|
18
|
+
});
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
n.default = e;
|
23
|
+
return Object.freeze(n);
|
24
|
+
}
|
25
|
+
|
26
|
+
var Reanimated__namespace = /*#__PURE__*/_interopNamespaceDefault(Reanimated);
|
27
|
+
|
28
|
+
function _arrayLikeToArray(r, a) {
|
29
|
+
(null == a || a > r.length) && (a = r.length);
|
30
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
31
|
+
return n;
|
32
|
+
}
|
33
|
+
function _arrayWithHoles(r) {
|
34
|
+
if (Array.isArray(r)) return r;
|
35
|
+
}
|
36
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
37
|
+
try {
|
38
|
+
var i = n[a](c),
|
39
|
+
u = i.value;
|
40
|
+
} catch (n) {
|
41
|
+
return void e(n);
|
42
|
+
}
|
43
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
44
|
+
}
|
45
|
+
function _asyncToGenerator(n) {
|
46
|
+
return function () {
|
47
|
+
var t = this,
|
48
|
+
e = arguments;
|
49
|
+
return new Promise(function (r, o) {
|
50
|
+
var a = n.apply(t, e);
|
51
|
+
function _next(n) {
|
52
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
53
|
+
}
|
54
|
+
function _throw(n) {
|
55
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
56
|
+
}
|
57
|
+
_next(void 0);
|
58
|
+
});
|
59
|
+
};
|
60
|
+
}
|
61
|
+
function _iterableToArrayLimit(r, l) {
|
62
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
63
|
+
if (null != t) {
|
64
|
+
var e,
|
65
|
+
n,
|
66
|
+
i,
|
67
|
+
u,
|
68
|
+
a = [],
|
69
|
+
f = !0,
|
70
|
+
o = !1;
|
71
|
+
try {
|
72
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
73
|
+
} catch (r) {
|
74
|
+
o = !0, n = r;
|
75
|
+
} finally {
|
76
|
+
try {
|
77
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
78
|
+
} finally {
|
79
|
+
if (o) throw n;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
return a;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
function _nonIterableRest() {
|
86
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
87
|
+
}
|
88
|
+
function _regeneratorRuntime() {
|
89
|
+
_regeneratorRuntime = function () {
|
90
|
+
return e;
|
91
|
+
};
|
92
|
+
var t,
|
93
|
+
e = {},
|
94
|
+
r = Object.prototype,
|
95
|
+
n = r.hasOwnProperty,
|
96
|
+
o = Object.defineProperty || function (t, e, r) {
|
97
|
+
t[e] = r.value;
|
98
|
+
},
|
99
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
100
|
+
a = i.iterator || "@@iterator",
|
101
|
+
c = i.asyncIterator || "@@asyncIterator",
|
102
|
+
u = i.toStringTag || "@@toStringTag";
|
103
|
+
function define(t, e, r) {
|
104
|
+
return Object.defineProperty(t, e, {
|
105
|
+
value: r,
|
106
|
+
enumerable: !0,
|
107
|
+
configurable: !0,
|
108
|
+
writable: !0
|
109
|
+
}), t[e];
|
110
|
+
}
|
111
|
+
try {
|
112
|
+
define({}, "");
|
113
|
+
} catch (t) {
|
114
|
+
define = function (t, e, r) {
|
115
|
+
return t[e] = r;
|
116
|
+
};
|
117
|
+
}
|
118
|
+
function wrap(t, e, r, n) {
|
119
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
120
|
+
a = Object.create(i.prototype),
|
121
|
+
c = new Context(n || []);
|
122
|
+
return o(a, "_invoke", {
|
123
|
+
value: makeInvokeMethod(t, r, c)
|
124
|
+
}), a;
|
125
|
+
}
|
126
|
+
function tryCatch(t, e, r) {
|
127
|
+
try {
|
128
|
+
return {
|
129
|
+
type: "normal",
|
130
|
+
arg: t.call(e, r)
|
131
|
+
};
|
132
|
+
} catch (t) {
|
133
|
+
return {
|
134
|
+
type: "throw",
|
135
|
+
arg: t
|
136
|
+
};
|
137
|
+
}
|
138
|
+
}
|
139
|
+
e.wrap = wrap;
|
140
|
+
var h = "suspendedStart",
|
141
|
+
l = "suspendedYield",
|
142
|
+
f = "executing",
|
143
|
+
s = "completed",
|
144
|
+
y = {};
|
145
|
+
function Generator() {}
|
146
|
+
function GeneratorFunction() {}
|
147
|
+
function GeneratorFunctionPrototype() {}
|
148
|
+
var p = {};
|
149
|
+
define(p, a, function () {
|
150
|
+
return this;
|
151
|
+
});
|
152
|
+
var d = Object.getPrototypeOf,
|
153
|
+
v = d && d(d(values([])));
|
154
|
+
v && v !== r && n.call(v, a) && (p = v);
|
155
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
156
|
+
function defineIteratorMethods(t) {
|
157
|
+
["next", "throw", "return"].forEach(function (e) {
|
158
|
+
define(t, e, function (t) {
|
159
|
+
return this._invoke(e, t);
|
160
|
+
});
|
161
|
+
});
|
162
|
+
}
|
163
|
+
function AsyncIterator(t, e) {
|
164
|
+
function invoke(r, o, i, a) {
|
165
|
+
var c = tryCatch(t[r], t, o);
|
166
|
+
if ("throw" !== c.type) {
|
167
|
+
var u = c.arg,
|
168
|
+
h = u.value;
|
169
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
170
|
+
invoke("next", t, i, a);
|
171
|
+
}, function (t) {
|
172
|
+
invoke("throw", t, i, a);
|
173
|
+
}) : e.resolve(h).then(function (t) {
|
174
|
+
u.value = t, i(u);
|
175
|
+
}, function (t) {
|
176
|
+
return invoke("throw", t, i, a);
|
177
|
+
});
|
178
|
+
}
|
179
|
+
a(c.arg);
|
180
|
+
}
|
181
|
+
var r;
|
182
|
+
o(this, "_invoke", {
|
183
|
+
value: function (t, n) {
|
184
|
+
function callInvokeWithMethodAndArg() {
|
185
|
+
return new e(function (e, r) {
|
186
|
+
invoke(t, n, e, r);
|
187
|
+
});
|
188
|
+
}
|
189
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
190
|
+
}
|
191
|
+
});
|
192
|
+
}
|
193
|
+
function makeInvokeMethod(e, r, n) {
|
194
|
+
var o = h;
|
195
|
+
return function (i, a) {
|
196
|
+
if (o === f) throw Error("Generator is already running");
|
197
|
+
if (o === s) {
|
198
|
+
if ("throw" === i) throw a;
|
199
|
+
return {
|
200
|
+
value: t,
|
201
|
+
done: !0
|
202
|
+
};
|
203
|
+
}
|
204
|
+
for (n.method = i, n.arg = a;;) {
|
205
|
+
var c = n.delegate;
|
206
|
+
if (c) {
|
207
|
+
var u = maybeInvokeDelegate(c, n);
|
208
|
+
if (u) {
|
209
|
+
if (u === y) continue;
|
210
|
+
return u;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
214
|
+
if (o === h) throw o = s, n.arg;
|
215
|
+
n.dispatchException(n.arg);
|
216
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
217
|
+
o = f;
|
218
|
+
var p = tryCatch(e, r, n);
|
219
|
+
if ("normal" === p.type) {
|
220
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
221
|
+
return {
|
222
|
+
value: p.arg,
|
223
|
+
done: n.done
|
224
|
+
};
|
225
|
+
}
|
226
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
227
|
+
}
|
228
|
+
};
|
229
|
+
}
|
230
|
+
function maybeInvokeDelegate(e, r) {
|
231
|
+
var n = r.method,
|
232
|
+
o = e.iterator[n];
|
233
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
234
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
235
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
236
|
+
var a = i.arg;
|
237
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
238
|
+
}
|
239
|
+
function pushTryEntry(t) {
|
240
|
+
var e = {
|
241
|
+
tryLoc: t[0]
|
242
|
+
};
|
243
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
244
|
+
}
|
245
|
+
function resetTryEntry(t) {
|
246
|
+
var e = t.completion || {};
|
247
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
248
|
+
}
|
249
|
+
function Context(t) {
|
250
|
+
this.tryEntries = [{
|
251
|
+
tryLoc: "root"
|
252
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
253
|
+
}
|
254
|
+
function values(e) {
|
255
|
+
if (e || "" === e) {
|
256
|
+
var r = e[a];
|
257
|
+
if (r) return r.call(e);
|
258
|
+
if ("function" == typeof e.next) return e;
|
259
|
+
if (!isNaN(e.length)) {
|
260
|
+
var o = -1,
|
261
|
+
i = function next() {
|
262
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
263
|
+
return next.value = t, next.done = !0, next;
|
264
|
+
};
|
265
|
+
return i.next = i;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
throw new TypeError(typeof e + " is not iterable");
|
269
|
+
}
|
270
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
271
|
+
value: GeneratorFunctionPrototype,
|
272
|
+
configurable: !0
|
273
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
274
|
+
value: GeneratorFunction,
|
275
|
+
configurable: !0
|
276
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
277
|
+
var e = "function" == typeof t && t.constructor;
|
278
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
279
|
+
}, e.mark = function (t) {
|
280
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
281
|
+
}, e.awrap = function (t) {
|
282
|
+
return {
|
283
|
+
__await: t
|
284
|
+
};
|
285
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
286
|
+
return this;
|
287
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
288
|
+
void 0 === i && (i = Promise);
|
289
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
290
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
291
|
+
return t.done ? t.value : a.next();
|
292
|
+
});
|
293
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
294
|
+
return this;
|
295
|
+
}), define(g, "toString", function () {
|
296
|
+
return "[object Generator]";
|
297
|
+
}), e.keys = function (t) {
|
298
|
+
var e = Object(t),
|
299
|
+
r = [];
|
300
|
+
for (var n in e) r.push(n);
|
301
|
+
return r.reverse(), function next() {
|
302
|
+
for (; r.length;) {
|
303
|
+
var t = r.pop();
|
304
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
305
|
+
}
|
306
|
+
return next.done = !0, next;
|
307
|
+
};
|
308
|
+
}, e.values = values, Context.prototype = {
|
309
|
+
constructor: Context,
|
310
|
+
reset: function (e) {
|
311
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
312
|
+
},
|
313
|
+
stop: function () {
|
314
|
+
this.done = !0;
|
315
|
+
var t = this.tryEntries[0].completion;
|
316
|
+
if ("throw" === t.type) throw t.arg;
|
317
|
+
return this.rval;
|
318
|
+
},
|
319
|
+
dispatchException: function (e) {
|
320
|
+
if (this.done) throw e;
|
321
|
+
var r = this;
|
322
|
+
function handle(n, o) {
|
323
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
324
|
+
}
|
325
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
326
|
+
var i = this.tryEntries[o],
|
327
|
+
a = i.completion;
|
328
|
+
if ("root" === i.tryLoc) return handle("end");
|
329
|
+
if (i.tryLoc <= this.prev) {
|
330
|
+
var c = n.call(i, "catchLoc"),
|
331
|
+
u = n.call(i, "finallyLoc");
|
332
|
+
if (c && u) {
|
333
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
334
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
335
|
+
} else if (c) {
|
336
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
337
|
+
} else {
|
338
|
+
if (!u) throw Error("try statement without catch or finally");
|
339
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
}
|
343
|
+
},
|
344
|
+
abrupt: function (t, e) {
|
345
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
346
|
+
var o = this.tryEntries[r];
|
347
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
348
|
+
var i = o;
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
353
|
+
var a = i ? i.completion : {};
|
354
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
355
|
+
},
|
356
|
+
complete: function (t, e) {
|
357
|
+
if ("throw" === t.type) throw t.arg;
|
358
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
359
|
+
},
|
360
|
+
finish: function (t) {
|
361
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
362
|
+
var r = this.tryEntries[e];
|
363
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
364
|
+
}
|
365
|
+
},
|
366
|
+
catch: function (t) {
|
367
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
368
|
+
var r = this.tryEntries[e];
|
369
|
+
if (r.tryLoc === t) {
|
370
|
+
var n = r.completion;
|
371
|
+
if ("throw" === n.type) {
|
372
|
+
var o = n.arg;
|
373
|
+
resetTryEntry(r);
|
374
|
+
}
|
375
|
+
return o;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
throw Error("illegal catch attempt");
|
379
|
+
},
|
380
|
+
delegateYield: function (e, r, n) {
|
381
|
+
return this.delegate = {
|
382
|
+
iterator: values(e),
|
383
|
+
resultName: r,
|
384
|
+
nextLoc: n
|
385
|
+
}, "next" === this.method && (this.arg = t), y;
|
386
|
+
}
|
387
|
+
}, e;
|
388
|
+
}
|
389
|
+
function _slicedToArray(r, e) {
|
390
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
391
|
+
}
|
392
|
+
function _unsupportedIterableToArray(r, a) {
|
393
|
+
if (r) {
|
394
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
395
|
+
var t = {}.toString.call(r).slice(8, -1);
|
396
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
397
|
+
}
|
398
|
+
}
|
68
399
|
|
69
400
|
// src/styles/colors.ts
|
70
401
|
var lightTheme = {
|
@@ -168,43 +499,52 @@ var ThemeContext = /*#__PURE__*/React.createContext({
|
|
168
499
|
* @param children - The child components that will consume the theme context.
|
169
500
|
* @param initialTheme - Optional prop to set the initial theme.
|
170
501
|
*/
|
171
|
-
var ThemeProvider = function ThemeProvider(
|
172
|
-
var children =
|
173
|
-
initialTheme =
|
174
|
-
var
|
175
|
-
|
176
|
-
|
502
|
+
var ThemeProvider = function ThemeProvider(_ref) {
|
503
|
+
var children = _ref.children,
|
504
|
+
initialTheme = _ref.initialTheme;
|
505
|
+
var _useState = React.useState(null),
|
506
|
+
_useState2 = _slicedToArray(_useState, 2),
|
507
|
+
colorScheme = _useState2[0],
|
508
|
+
setColorScheme = _useState2[1];
|
177
509
|
// Use useAsyncStorage hook for managing the theme storage
|
178
|
-
var
|
179
|
-
getItem =
|
180
|
-
setItem =
|
510
|
+
var _useAsyncStorage = asyncStorage.useAsyncStorage('theme'),
|
511
|
+
getItem = _useAsyncStorage.getItem,
|
512
|
+
setItem = _useAsyncStorage.setItem;
|
181
513
|
React.useEffect(function () {
|
182
|
-
var loadTheme = function
|
183
|
-
|
514
|
+
var loadTheme = /*#__PURE__*/function () {
|
515
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
184
516
|
var systemTheme;
|
185
|
-
return
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
517
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
518
|
+
while (1) switch (_context.prev = _context.next) {
|
519
|
+
case 0:
|
520
|
+
try {
|
521
|
+
// const storedTheme = await getItem();
|
522
|
+
// if (storedTheme === 'dark' || storedTheme === 'light') {
|
523
|
+
// setColorScheme(storedTheme);
|
524
|
+
//}
|
525
|
+
if (initialTheme) {
|
526
|
+
setColorScheme(initialTheme);
|
527
|
+
} else {
|
528
|
+
systemTheme = reactNative.Appearance.getColorScheme();
|
529
|
+
setColorScheme(systemTheme);
|
530
|
+
}
|
531
|
+
} catch (error) {
|
532
|
+
console.error('Failed to load theme.', error);
|
533
|
+
setColorScheme(reactNative.Appearance.getColorScheme());
|
534
|
+
}
|
535
|
+
case 1:
|
536
|
+
case "end":
|
537
|
+
return _context.stop();
|
200
538
|
}
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
539
|
+
}, _callee);
|
540
|
+
}));
|
541
|
+
return function loadTheme() {
|
542
|
+
return _ref2.apply(this, arguments);
|
543
|
+
};
|
544
|
+
}();
|
205
545
|
loadTheme();
|
206
|
-
var subscription = reactNative.Appearance.addChangeListener(function (
|
207
|
-
var colorScheme =
|
546
|
+
var subscription = reactNative.Appearance.addChangeListener(function (_ref3) {
|
547
|
+
var colorScheme = _ref3.colorScheme;
|
208
548
|
if (!colorScheme) return; // Prevent setting null
|
209
549
|
setColorScheme(colorScheme);
|
210
550
|
});
|
@@ -212,29 +552,34 @@ var ThemeProvider = function ThemeProvider(_a) {
|
|
212
552
|
return subscription.remove();
|
213
553
|
};
|
214
554
|
}, [initialTheme, getItem]);
|
215
|
-
var toggleTheme = function
|
216
|
-
|
217
|
-
var newTheme
|
218
|
-
return
|
219
|
-
switch (
|
555
|
+
var toggleTheme = /*#__PURE__*/function () {
|
556
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
557
|
+
var newTheme;
|
558
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
559
|
+
while (1) switch (_context2.prev = _context2.next) {
|
220
560
|
case 0:
|
221
|
-
|
561
|
+
_context2.prev = 0;
|
222
562
|
newTheme = colorScheme === 'dark' ? 'light' : 'dark';
|
223
563
|
setColorScheme(newTheme);
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
564
|
+
_context2.next = 5;
|
565
|
+
return setItem(newTheme);
|
566
|
+
case 5:
|
567
|
+
_context2.next = 10;
|
568
|
+
break;
|
569
|
+
case 7:
|
570
|
+
_context2.prev = 7;
|
571
|
+
_context2.t0 = _context2["catch"](0);
|
572
|
+
console.error('Failed to toggle theme.', _context2.t0);
|
573
|
+
case 10:
|
574
|
+
case "end":
|
575
|
+
return _context2.stop();
|
234
576
|
}
|
235
|
-
});
|
236
|
-
});
|
237
|
-
|
577
|
+
}, _callee2, null, [[0, 7]]);
|
578
|
+
}));
|
579
|
+
return function toggleTheme() {
|
580
|
+
return _ref4.apply(this, arguments);
|
581
|
+
};
|
582
|
+
}();
|
238
583
|
var theme = {
|
239
584
|
colors: colorScheme === 'dark' ? darkTheme : lightTheme
|
240
585
|
};
|
@@ -247,9 +592,9 @@ var ThemeProvider = function ThemeProvider(_a) {
|
|
247
592
|
};
|
248
593
|
|
249
594
|
var ThemeToggle = function ThemeToggle() {
|
250
|
-
var
|
251
|
-
theme =
|
252
|
-
toggleTheme =
|
595
|
+
var _useContext = React.useContext(ThemeContext),
|
596
|
+
theme = _useContext.theme,
|
597
|
+
toggleTheme = _useContext.toggleTheme;
|
253
598
|
var isDarkMode = theme.colors === darkTheme;
|
254
599
|
return /*#__PURE__*/React.createElement(reactNative.View, {
|
255
600
|
style: styles$2.container
|
@@ -324,20 +669,21 @@ function typeStyles(type, disabled, themeColors) {
|
|
324
669
|
* @param borderRadius - Custom border radius value. Overrides the `rounded` prop if provided.
|
325
670
|
* @param type - Specifies the button type for styling ('submit', 'button', 'cancel').
|
326
671
|
*/
|
327
|
-
var Button = function Button(
|
328
|
-
var children =
|
329
|
-
|
330
|
-
disabled =
|
331
|
-
|
332
|
-
type =
|
333
|
-
|
334
|
-
rounded =
|
335
|
-
|
336
|
-
borderRadius =
|
337
|
-
|
338
|
-
isFullWidth =
|
339
|
-
onPress =
|
340
|
-
var
|
672
|
+
var Button = function Button(_ref) {
|
673
|
+
var children = _ref.children,
|
674
|
+
_ref$disabled = _ref.disabled,
|
675
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
676
|
+
_ref$type = _ref.type,
|
677
|
+
type = _ref$type === void 0 ? 'button' : _ref$type,
|
678
|
+
_ref$rounded = _ref.rounded,
|
679
|
+
rounded = _ref$rounded === void 0 ? true : _ref$rounded,
|
680
|
+
_ref$borderRadius = _ref.borderRadius,
|
681
|
+
borderRadius = _ref$borderRadius === void 0 ? 30 : _ref$borderRadius,
|
682
|
+
_ref$isFullWidth = _ref.isFullWidth,
|
683
|
+
isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
|
684
|
+
onPress = _ref.onPress;
|
685
|
+
var _useContext = React.useContext(ThemeContext),
|
686
|
+
theme = _useContext.theme;
|
341
687
|
var colors = theme.colors;
|
342
688
|
var computedStyles = React.useMemo(function () {
|
343
689
|
return reactNative.StyleSheet.flatten([styles$1.button, typeStyles(type, disabled, colors), rounded && {
|
@@ -373,6 +719,10 @@ var styles$1 = reactNative.StyleSheet.create({
|
|
373
719
|
});
|
374
720
|
|
375
721
|
// src/cards/Card.tsx
|
722
|
+
var Animated = Reanimated__namespace["default"];
|
723
|
+
var useAnimatedStyle = Reanimated__namespace.useAnimatedStyle,
|
724
|
+
useSharedValue = Reanimated__namespace.useSharedValue,
|
725
|
+
withSpring = Reanimated__namespace.withSpring;
|
376
726
|
/**
|
377
727
|
* Card component that adapts its styles based on the current theme.
|
378
728
|
* Supports dynamic styling, shadows, and press animations.
|
@@ -385,23 +735,24 @@ var styles$1 = reactNative.StyleSheet.create({
|
|
385
735
|
* @param elevation - Elevation for Android shadow. Overrides default.
|
386
736
|
* @param shadowProps - Custom shadow properties for iOS. Overrides defaults.
|
387
737
|
*/
|
388
|
-
var Card = function Card(
|
389
|
-
var children =
|
390
|
-
style =
|
391
|
-
onPress =
|
392
|
-
|
393
|
-
pressable =
|
394
|
-
|
395
|
-
borderRadius =
|
396
|
-
|
397
|
-
elevation =
|
398
|
-
|
399
|
-
shadowProps =
|
400
|
-
var
|
738
|
+
var Card = function Card(_ref) {
|
739
|
+
var children = _ref.children,
|
740
|
+
style = _ref.style,
|
741
|
+
onPress = _ref.onPress,
|
742
|
+
_ref$pressable = _ref.pressable,
|
743
|
+
pressable = _ref$pressable === void 0 ? false : _ref$pressable,
|
744
|
+
_ref$borderRadius = _ref.borderRadius,
|
745
|
+
borderRadius = _ref$borderRadius === void 0 ? 12 : _ref$borderRadius,
|
746
|
+
_ref$elevation = _ref.elevation,
|
747
|
+
elevation = _ref$elevation === void 0 ? 4 : _ref$elevation,
|
748
|
+
_ref$shadowProps = _ref.shadowProps,
|
749
|
+
shadowProps = _ref$shadowProps === void 0 ? {} : _ref$shadowProps;
|
750
|
+
var _useContext = React.useContext(ThemeContext),
|
751
|
+
theme = _useContext.theme;
|
401
752
|
var colors = theme.colors;
|
402
753
|
// Animation state for pressable effect
|
403
|
-
var scale =
|
404
|
-
var animatedStyle =
|
754
|
+
var scale = useSharedValue(1);
|
755
|
+
var animatedStyle = useAnimatedStyle(function () {
|
405
756
|
return {
|
406
757
|
transform: [{
|
407
758
|
scale: scale.value
|
@@ -409,10 +760,10 @@ var Card = function Card(_a) {
|
|
409
760
|
};
|
410
761
|
});
|
411
762
|
var handlePressIn = function handlePressIn() {
|
412
|
-
scale.value =
|
763
|
+
scale.value = withSpring(0.95);
|
413
764
|
};
|
414
765
|
var handlePressOut = function handlePressOut() {
|
415
|
-
scale.value =
|
766
|
+
scale.value = withSpring(1);
|
416
767
|
};
|
417
768
|
// Default shadow styles (improved platform-specific handling)
|
418
769
|
var defaultShadow = reactNative.Platform.select({
|