aport-tools 4.0.30 → 4.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/defaults/reanimatedWrapper.d.ts +2 -0
- package/dist/index.esm.js +471 -143
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +475 -147
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -1,68 +1,380 @@
|
|
1
|
-
/*! aport-tools v4.0.
|
1
|
+
/*! aport-tools v4.0.31 | ISC */
|
2
2
|
import React, { createContext, useState, useEffect, useContext, useMemo } from 'react';
|
3
3
|
import { Appearance, StyleSheet, View, Text, Switch, TouchableOpacity, Platform } from 'react-native';
|
4
4
|
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
|
5
|
-
import
|
5
|
+
import useAnimated, { useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated';
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
function
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if (
|
59
|
-
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
7
|
+
function _arrayLikeToArray(r, a) {
|
8
|
+
(null == a || a > r.length) && (a = r.length);
|
9
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
10
|
+
return n;
|
11
|
+
}
|
12
|
+
function _arrayWithHoles(r) {
|
13
|
+
if (Array.isArray(r)) return r;
|
14
|
+
}
|
15
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
16
|
+
try {
|
17
|
+
var i = n[a](c),
|
18
|
+
u = i.value;
|
19
|
+
} catch (n) {
|
20
|
+
return void e(n);
|
21
|
+
}
|
22
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
23
|
+
}
|
24
|
+
function _asyncToGenerator(n) {
|
25
|
+
return function () {
|
26
|
+
var t = this,
|
27
|
+
e = arguments;
|
28
|
+
return new Promise(function (r, o) {
|
29
|
+
var a = n.apply(t, e);
|
30
|
+
function _next(n) {
|
31
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
32
|
+
}
|
33
|
+
function _throw(n) {
|
34
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
35
|
+
}
|
36
|
+
_next(void 0);
|
37
|
+
});
|
38
|
+
};
|
39
|
+
}
|
40
|
+
function _iterableToArrayLimit(r, l) {
|
41
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
42
|
+
if (null != t) {
|
43
|
+
var e,
|
44
|
+
n,
|
45
|
+
i,
|
46
|
+
u,
|
47
|
+
a = [],
|
48
|
+
f = !0,
|
49
|
+
o = !1;
|
50
|
+
try {
|
51
|
+
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);
|
52
|
+
} catch (r) {
|
53
|
+
o = !0, n = r;
|
54
|
+
} finally {
|
55
|
+
try {
|
56
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
57
|
+
} finally {
|
58
|
+
if (o) throw n;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return a;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
function _nonIterableRest() {
|
65
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
66
|
+
}
|
67
|
+
function _regeneratorRuntime() {
|
68
|
+
_regeneratorRuntime = function () {
|
69
|
+
return e;
|
70
|
+
};
|
71
|
+
var t,
|
72
|
+
e = {},
|
73
|
+
r = Object.prototype,
|
74
|
+
n = r.hasOwnProperty,
|
75
|
+
o = Object.defineProperty || function (t, e, r) {
|
76
|
+
t[e] = r.value;
|
77
|
+
},
|
78
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
79
|
+
a = i.iterator || "@@iterator",
|
80
|
+
c = i.asyncIterator || "@@asyncIterator",
|
81
|
+
u = i.toStringTag || "@@toStringTag";
|
82
|
+
function define(t, e, r) {
|
83
|
+
return Object.defineProperty(t, e, {
|
84
|
+
value: r,
|
85
|
+
enumerable: !0,
|
86
|
+
configurable: !0,
|
87
|
+
writable: !0
|
88
|
+
}), t[e];
|
89
|
+
}
|
90
|
+
try {
|
91
|
+
define({}, "");
|
92
|
+
} catch (t) {
|
93
|
+
define = function (t, e, r) {
|
94
|
+
return t[e] = r;
|
95
|
+
};
|
96
|
+
}
|
97
|
+
function wrap(t, e, r, n) {
|
98
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
99
|
+
a = Object.create(i.prototype),
|
100
|
+
c = new Context(n || []);
|
101
|
+
return o(a, "_invoke", {
|
102
|
+
value: makeInvokeMethod(t, r, c)
|
103
|
+
}), a;
|
104
|
+
}
|
105
|
+
function tryCatch(t, e, r) {
|
106
|
+
try {
|
107
|
+
return {
|
108
|
+
type: "normal",
|
109
|
+
arg: t.call(e, r)
|
110
|
+
};
|
111
|
+
} catch (t) {
|
112
|
+
return {
|
113
|
+
type: "throw",
|
114
|
+
arg: t
|
115
|
+
};
|
116
|
+
}
|
117
|
+
}
|
118
|
+
e.wrap = wrap;
|
119
|
+
var h = "suspendedStart",
|
120
|
+
l = "suspendedYield",
|
121
|
+
f = "executing",
|
122
|
+
s = "completed",
|
123
|
+
y = {};
|
124
|
+
function Generator() {}
|
125
|
+
function GeneratorFunction() {}
|
126
|
+
function GeneratorFunctionPrototype() {}
|
127
|
+
var p = {};
|
128
|
+
define(p, a, function () {
|
129
|
+
return this;
|
130
|
+
});
|
131
|
+
var d = Object.getPrototypeOf,
|
132
|
+
v = d && d(d(values([])));
|
133
|
+
v && v !== r && n.call(v, a) && (p = v);
|
134
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
135
|
+
function defineIteratorMethods(t) {
|
136
|
+
["next", "throw", "return"].forEach(function (e) {
|
137
|
+
define(t, e, function (t) {
|
138
|
+
return this._invoke(e, t);
|
139
|
+
});
|
140
|
+
});
|
141
|
+
}
|
142
|
+
function AsyncIterator(t, e) {
|
143
|
+
function invoke(r, o, i, a) {
|
144
|
+
var c = tryCatch(t[r], t, o);
|
145
|
+
if ("throw" !== c.type) {
|
146
|
+
var u = c.arg,
|
147
|
+
h = u.value;
|
148
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
149
|
+
invoke("next", t, i, a);
|
150
|
+
}, function (t) {
|
151
|
+
invoke("throw", t, i, a);
|
152
|
+
}) : e.resolve(h).then(function (t) {
|
153
|
+
u.value = t, i(u);
|
154
|
+
}, function (t) {
|
155
|
+
return invoke("throw", t, i, a);
|
156
|
+
});
|
157
|
+
}
|
158
|
+
a(c.arg);
|
159
|
+
}
|
160
|
+
var r;
|
161
|
+
o(this, "_invoke", {
|
162
|
+
value: function (t, n) {
|
163
|
+
function callInvokeWithMethodAndArg() {
|
164
|
+
return new e(function (e, r) {
|
165
|
+
invoke(t, n, e, r);
|
166
|
+
});
|
167
|
+
}
|
168
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
169
|
+
}
|
170
|
+
});
|
171
|
+
}
|
172
|
+
function makeInvokeMethod(e, r, n) {
|
173
|
+
var o = h;
|
174
|
+
return function (i, a) {
|
175
|
+
if (o === f) throw Error("Generator is already running");
|
176
|
+
if (o === s) {
|
177
|
+
if ("throw" === i) throw a;
|
178
|
+
return {
|
179
|
+
value: t,
|
180
|
+
done: !0
|
181
|
+
};
|
182
|
+
}
|
183
|
+
for (n.method = i, n.arg = a;;) {
|
184
|
+
var c = n.delegate;
|
185
|
+
if (c) {
|
186
|
+
var u = maybeInvokeDelegate(c, n);
|
187
|
+
if (u) {
|
188
|
+
if (u === y) continue;
|
189
|
+
return u;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
193
|
+
if (o === h) throw o = s, n.arg;
|
194
|
+
n.dispatchException(n.arg);
|
195
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
196
|
+
o = f;
|
197
|
+
var p = tryCatch(e, r, n);
|
198
|
+
if ("normal" === p.type) {
|
199
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
200
|
+
return {
|
201
|
+
value: p.arg,
|
202
|
+
done: n.done
|
203
|
+
};
|
204
|
+
}
|
205
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
206
|
+
}
|
207
|
+
};
|
208
|
+
}
|
209
|
+
function maybeInvokeDelegate(e, r) {
|
210
|
+
var n = r.method,
|
211
|
+
o = e.iterator[n];
|
212
|
+
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;
|
213
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
214
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
215
|
+
var a = i.arg;
|
216
|
+
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);
|
217
|
+
}
|
218
|
+
function pushTryEntry(t) {
|
219
|
+
var e = {
|
220
|
+
tryLoc: t[0]
|
221
|
+
};
|
222
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
223
|
+
}
|
224
|
+
function resetTryEntry(t) {
|
225
|
+
var e = t.completion || {};
|
226
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
227
|
+
}
|
228
|
+
function Context(t) {
|
229
|
+
this.tryEntries = [{
|
230
|
+
tryLoc: "root"
|
231
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
232
|
+
}
|
233
|
+
function values(e) {
|
234
|
+
if (e || "" === e) {
|
235
|
+
var r = e[a];
|
236
|
+
if (r) return r.call(e);
|
237
|
+
if ("function" == typeof e.next) return e;
|
238
|
+
if (!isNaN(e.length)) {
|
239
|
+
var o = -1,
|
240
|
+
i = function next() {
|
241
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
242
|
+
return next.value = t, next.done = !0, next;
|
243
|
+
};
|
244
|
+
return i.next = i;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
throw new TypeError(typeof e + " is not iterable");
|
248
|
+
}
|
249
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
250
|
+
value: GeneratorFunctionPrototype,
|
251
|
+
configurable: !0
|
252
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
253
|
+
value: GeneratorFunction,
|
254
|
+
configurable: !0
|
255
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
256
|
+
var e = "function" == typeof t && t.constructor;
|
257
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
258
|
+
}, e.mark = function (t) {
|
259
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
260
|
+
}, e.awrap = function (t) {
|
261
|
+
return {
|
262
|
+
__await: t
|
263
|
+
};
|
264
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
265
|
+
return this;
|
266
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
267
|
+
void 0 === i && (i = Promise);
|
268
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
269
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
270
|
+
return t.done ? t.value : a.next();
|
271
|
+
});
|
272
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
273
|
+
return this;
|
274
|
+
}), define(g, "toString", function () {
|
275
|
+
return "[object Generator]";
|
276
|
+
}), e.keys = function (t) {
|
277
|
+
var e = Object(t),
|
278
|
+
r = [];
|
279
|
+
for (var n in e) r.push(n);
|
280
|
+
return r.reverse(), function next() {
|
281
|
+
for (; r.length;) {
|
282
|
+
var t = r.pop();
|
283
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
284
|
+
}
|
285
|
+
return next.done = !0, next;
|
286
|
+
};
|
287
|
+
}, e.values = values, Context.prototype = {
|
288
|
+
constructor: Context,
|
289
|
+
reset: function (e) {
|
290
|
+
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);
|
291
|
+
},
|
292
|
+
stop: function () {
|
293
|
+
this.done = !0;
|
294
|
+
var t = this.tryEntries[0].completion;
|
295
|
+
if ("throw" === t.type) throw t.arg;
|
296
|
+
return this.rval;
|
297
|
+
},
|
298
|
+
dispatchException: function (e) {
|
299
|
+
if (this.done) throw e;
|
300
|
+
var r = this;
|
301
|
+
function handle(n, o) {
|
302
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
303
|
+
}
|
304
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
305
|
+
var i = this.tryEntries[o],
|
306
|
+
a = i.completion;
|
307
|
+
if ("root" === i.tryLoc) return handle("end");
|
308
|
+
if (i.tryLoc <= this.prev) {
|
309
|
+
var c = n.call(i, "catchLoc"),
|
310
|
+
u = n.call(i, "finallyLoc");
|
311
|
+
if (c && u) {
|
312
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
313
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
314
|
+
} else if (c) {
|
315
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
316
|
+
} else {
|
317
|
+
if (!u) throw Error("try statement without catch or finally");
|
318
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
},
|
323
|
+
abrupt: function (t, e) {
|
324
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
325
|
+
var o = this.tryEntries[r];
|
326
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
327
|
+
var i = o;
|
328
|
+
break;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
332
|
+
var a = i ? i.completion : {};
|
333
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
334
|
+
},
|
335
|
+
complete: function (t, e) {
|
336
|
+
if ("throw" === t.type) throw t.arg;
|
337
|
+
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;
|
338
|
+
},
|
339
|
+
finish: function (t) {
|
340
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
341
|
+
var r = this.tryEntries[e];
|
342
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
343
|
+
}
|
344
|
+
},
|
345
|
+
catch: function (t) {
|
346
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
347
|
+
var r = this.tryEntries[e];
|
348
|
+
if (r.tryLoc === t) {
|
349
|
+
var n = r.completion;
|
350
|
+
if ("throw" === n.type) {
|
351
|
+
var o = n.arg;
|
352
|
+
resetTryEntry(r);
|
353
|
+
}
|
354
|
+
return o;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
throw Error("illegal catch attempt");
|
358
|
+
},
|
359
|
+
delegateYield: function (e, r, n) {
|
360
|
+
return this.delegate = {
|
361
|
+
iterator: values(e),
|
362
|
+
resultName: r,
|
363
|
+
nextLoc: n
|
364
|
+
}, "next" === this.method && (this.arg = t), y;
|
365
|
+
}
|
366
|
+
}, e;
|
367
|
+
}
|
368
|
+
function _slicedToArray(r, e) {
|
369
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
370
|
+
}
|
371
|
+
function _unsupportedIterableToArray(r, a) {
|
372
|
+
if (r) {
|
373
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
374
|
+
var t = {}.toString.call(r).slice(8, -1);
|
375
|
+
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;
|
376
|
+
}
|
377
|
+
}
|
66
378
|
|
67
379
|
// src/styles/colors.ts
|
68
380
|
var lightTheme = {
|
@@ -166,43 +478,52 @@ var ThemeContext = /*#__PURE__*/createContext({
|
|
166
478
|
* @param children - The child components that will consume the theme context.
|
167
479
|
* @param initialTheme - Optional prop to set the initial theme.
|
168
480
|
*/
|
169
|
-
var ThemeProvider = function ThemeProvider(
|
170
|
-
var children =
|
171
|
-
initialTheme =
|
172
|
-
var
|
173
|
-
|
174
|
-
|
481
|
+
var ThemeProvider = function ThemeProvider(_ref) {
|
482
|
+
var children = _ref.children,
|
483
|
+
initialTheme = _ref.initialTheme;
|
484
|
+
var _useState = useState(null),
|
485
|
+
_useState2 = _slicedToArray(_useState, 2),
|
486
|
+
colorScheme = _useState2[0],
|
487
|
+
setColorScheme = _useState2[1];
|
175
488
|
// Use useAsyncStorage hook for managing the theme storage
|
176
|
-
var
|
177
|
-
getItem =
|
178
|
-
setItem =
|
489
|
+
var _useAsyncStorage = useAsyncStorage('theme'),
|
490
|
+
getItem = _useAsyncStorage.getItem,
|
491
|
+
setItem = _useAsyncStorage.setItem;
|
179
492
|
useEffect(function () {
|
180
|
-
var loadTheme = function
|
181
|
-
|
493
|
+
var loadTheme = /*#__PURE__*/function () {
|
494
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
182
495
|
var systemTheme;
|
183
|
-
return
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
496
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
497
|
+
while (1) switch (_context.prev = _context.next) {
|
498
|
+
case 0:
|
499
|
+
try {
|
500
|
+
// const storedTheme = await getItem();
|
501
|
+
// if (storedTheme === 'dark' || storedTheme === 'light') {
|
502
|
+
// setColorScheme(storedTheme);
|
503
|
+
//}
|
504
|
+
if (initialTheme) {
|
505
|
+
setColorScheme(initialTheme);
|
506
|
+
} else {
|
507
|
+
systemTheme = Appearance.getColorScheme();
|
508
|
+
setColorScheme(systemTheme);
|
509
|
+
}
|
510
|
+
} catch (error) {
|
511
|
+
console.error('Failed to load theme.', error);
|
512
|
+
setColorScheme(Appearance.getColorScheme());
|
513
|
+
}
|
514
|
+
case 1:
|
515
|
+
case "end":
|
516
|
+
return _context.stop();
|
198
517
|
}
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
518
|
+
}, _callee);
|
519
|
+
}));
|
520
|
+
return function loadTheme() {
|
521
|
+
return _ref2.apply(this, arguments);
|
522
|
+
};
|
523
|
+
}();
|
203
524
|
loadTheme();
|
204
|
-
var subscription = Appearance.addChangeListener(function (
|
205
|
-
var colorScheme =
|
525
|
+
var subscription = Appearance.addChangeListener(function (_ref3) {
|
526
|
+
var colorScheme = _ref3.colorScheme;
|
206
527
|
if (!colorScheme) return; // Prevent setting null
|
207
528
|
setColorScheme(colorScheme);
|
208
529
|
});
|
@@ -210,29 +531,34 @@ var ThemeProvider = function ThemeProvider(_a) {
|
|
210
531
|
return subscription.remove();
|
211
532
|
};
|
212
533
|
}, [initialTheme, getItem]);
|
213
|
-
var toggleTheme = function
|
214
|
-
|
215
|
-
var newTheme
|
216
|
-
return
|
217
|
-
switch (
|
534
|
+
var toggleTheme = /*#__PURE__*/function () {
|
535
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
536
|
+
var newTheme;
|
537
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
538
|
+
while (1) switch (_context2.prev = _context2.next) {
|
218
539
|
case 0:
|
219
|
-
|
540
|
+
_context2.prev = 0;
|
220
541
|
newTheme = colorScheme === 'dark' ? 'light' : 'dark';
|
221
542
|
setColorScheme(newTheme);
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
543
|
+
_context2.next = 5;
|
544
|
+
return setItem(newTheme);
|
545
|
+
case 5:
|
546
|
+
_context2.next = 10;
|
547
|
+
break;
|
548
|
+
case 7:
|
549
|
+
_context2.prev = 7;
|
550
|
+
_context2.t0 = _context2["catch"](0);
|
551
|
+
console.error('Failed to toggle theme.', _context2.t0);
|
552
|
+
case 10:
|
553
|
+
case "end":
|
554
|
+
return _context2.stop();
|
232
555
|
}
|
233
|
-
});
|
234
|
-
});
|
235
|
-
|
556
|
+
}, _callee2, null, [[0, 7]]);
|
557
|
+
}));
|
558
|
+
return function toggleTheme() {
|
559
|
+
return _ref4.apply(this, arguments);
|
560
|
+
};
|
561
|
+
}();
|
236
562
|
var theme = {
|
237
563
|
colors: colorScheme === 'dark' ? darkTheme : lightTheme
|
238
564
|
};
|
@@ -245,9 +571,9 @@ var ThemeProvider = function ThemeProvider(_a) {
|
|
245
571
|
};
|
246
572
|
|
247
573
|
var ThemeToggle = function ThemeToggle() {
|
248
|
-
var
|
249
|
-
theme =
|
250
|
-
toggleTheme =
|
574
|
+
var _useContext = useContext(ThemeContext),
|
575
|
+
theme = _useContext.theme,
|
576
|
+
toggleTheme = _useContext.toggleTheme;
|
251
577
|
var isDarkMode = theme.colors === darkTheme;
|
252
578
|
return /*#__PURE__*/React.createElement(View, {
|
253
579
|
style: styles$2.container
|
@@ -322,20 +648,21 @@ function typeStyles(type, disabled, themeColors) {
|
|
322
648
|
* @param borderRadius - Custom border radius value. Overrides the `rounded` prop if provided.
|
323
649
|
* @param type - Specifies the button type for styling ('submit', 'button', 'cancel').
|
324
650
|
*/
|
325
|
-
var Button = function Button(
|
326
|
-
var children =
|
327
|
-
|
328
|
-
disabled =
|
329
|
-
|
330
|
-
type =
|
331
|
-
|
332
|
-
rounded =
|
333
|
-
|
334
|
-
borderRadius =
|
335
|
-
|
336
|
-
isFullWidth =
|
337
|
-
onPress =
|
338
|
-
var
|
651
|
+
var Button = function Button(_ref) {
|
652
|
+
var children = _ref.children,
|
653
|
+
_ref$disabled = _ref.disabled,
|
654
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
655
|
+
_ref$type = _ref.type,
|
656
|
+
type = _ref$type === void 0 ? 'button' : _ref$type,
|
657
|
+
_ref$rounded = _ref.rounded,
|
658
|
+
rounded = _ref$rounded === void 0 ? true : _ref$rounded,
|
659
|
+
_ref$borderRadius = _ref.borderRadius,
|
660
|
+
borderRadius = _ref$borderRadius === void 0 ? 30 : _ref$borderRadius,
|
661
|
+
_ref$isFullWidth = _ref.isFullWidth,
|
662
|
+
isFullWidth = _ref$isFullWidth === void 0 ? false : _ref$isFullWidth,
|
663
|
+
onPress = _ref.onPress;
|
664
|
+
var _useContext = useContext(ThemeContext),
|
665
|
+
theme = _useContext.theme;
|
339
666
|
var colors = theme.colors;
|
340
667
|
var computedStyles = useMemo(function () {
|
341
668
|
return StyleSheet.flatten([styles$1.button, typeStyles(type, disabled, colors), rounded && {
|
@@ -383,19 +710,20 @@ var styles$1 = StyleSheet.create({
|
|
383
710
|
* @param elevation - Elevation for Android shadow. Overrides default.
|
384
711
|
* @param shadowProps - Custom shadow properties for iOS. Overrides defaults.
|
385
712
|
*/
|
386
|
-
var Card = function Card(
|
387
|
-
var children =
|
388
|
-
style =
|
389
|
-
onPress =
|
390
|
-
|
391
|
-
pressable =
|
392
|
-
|
393
|
-
borderRadius =
|
394
|
-
|
395
|
-
elevation =
|
396
|
-
|
397
|
-
shadowProps =
|
398
|
-
var
|
713
|
+
var Card = function Card(_ref) {
|
714
|
+
var children = _ref.children,
|
715
|
+
style = _ref.style,
|
716
|
+
onPress = _ref.onPress,
|
717
|
+
_ref$pressable = _ref.pressable,
|
718
|
+
pressable = _ref$pressable === void 0 ? false : _ref$pressable,
|
719
|
+
_ref$borderRadius = _ref.borderRadius,
|
720
|
+
borderRadius = _ref$borderRadius === void 0 ? 12 : _ref$borderRadius,
|
721
|
+
_ref$elevation = _ref.elevation,
|
722
|
+
elevation = _ref$elevation === void 0 ? 4 : _ref$elevation,
|
723
|
+
_ref$shadowProps = _ref.shadowProps,
|
724
|
+
shadowProps = _ref$shadowProps === void 0 ? {} : _ref$shadowProps;
|
725
|
+
var _useContext = useContext(ThemeContext),
|
726
|
+
theme = _useContext.theme;
|
399
727
|
var colors = theme.colors;
|
400
728
|
// Animation state for pressable effect
|
401
729
|
var scale = useSharedValue(1);
|
@@ -441,7 +769,7 @@ var Card = function Card(_a) {
|
|
441
769
|
onPressIn: handlePressIn,
|
442
770
|
onPressOut: handlePressOut,
|
443
771
|
style: cardStyles
|
444
|
-
}, /*#__PURE__*/React.createElement(
|
772
|
+
}, /*#__PURE__*/React.createElement(useAnimated.View, {
|
445
773
|
style: animatedStyle
|
446
774
|
}, children))) : (/*#__PURE__*/React.createElement(View, {
|
447
775
|
style: cardStyles
|