@innspel/react-native 0.9.0 → 0.9.2
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/README.md +12 -0
- package/dist/index.cjs +109 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +127 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/InnspelProvider.tsx
|
|
2
|
-
import { createContext as createContext3, useCallback as useCallback3, useContext as useContext4, useMemo as
|
|
2
|
+
import { createContext as createContext3, useCallback as useCallback3, useContext as useContext4, useMemo as useMemo4, useRef as useRef4, useState as useState4 } from "react";
|
|
3
3
|
import { View as View9 } from "react-native";
|
|
4
4
|
|
|
5
5
|
// src/skjermbilde.ts
|
|
@@ -355,7 +355,7 @@ import {
|
|
|
355
355
|
InnspelApiError,
|
|
356
356
|
InnspelQueueFullError
|
|
357
357
|
} from "@innspel/core";
|
|
358
|
-
import { useCallback as useCallback2, useContext as useContext3, useEffect, useRef as
|
|
358
|
+
import { useCallback as useCallback2, useContext as useContext3, useEffect, useRef as useRef3, useState as useState3 } from "react";
|
|
359
359
|
import { KeyboardAvoidingView, Modal, Pressable as Pressable5, View as View8 } from "react-native";
|
|
360
360
|
import { initialWindowMetrics, SafeAreaInsetsContext } from "react-native-safe-area-context";
|
|
361
361
|
|
|
@@ -369,11 +369,14 @@ var arrow_back_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBo
|
|
|
369
369
|
// ../../node_modules/ionicons/dist/svg/brush-outline.svg
|
|
370
370
|
var brush_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M452.37 59.63a40.49 40.49 0 0 0-57.26 0L184 294.74c23.08 4.7 46.12 27.29 49.26 49.26l219.11-227.11a40.49 40.49 0 0 0 0-57.26M138 336c-29.88 0-54 24.5-54 54.86 0 23.95-20.88 36.57-36 36.57C64.56 449.74 92.82 464 120 464c39.78 0 72-32.73 72-73.14 0-30.36-24.12-54.86-54-54.86" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/></svg>';
|
|
371
371
|
|
|
372
|
+
// ../../node_modules/ionicons/dist/svg/bug.svg
|
|
373
|
+
var bug_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M463.55 272.13H400v-48.2q0-4.32-.27-8.47c29.57-27.88 32.25-64.63 32.27-103 0-8.61-6.64-16-15.25-16.41A16 16 0 0 0 400 112c0 28-1.86 48.15-9.9 63.84-19.22-41.15-65.78-63.91-134.1-63.91-39.8 0-74.19 9.13-99.43 26.39-14.9 10.19-26.2 22.91-33.7 37.72C114 160.65 112 141 112 112.46c0-8.61-6.6-16-15.2-16.44A16 16 0 0 0 80 112c0 37.63 2.61 73.73 32.44 101.63q-.43 5.06-.44 10.3v48.2H48.45c-8.61 0-16 6.62-16.43 15.23a16 16 0 0 0 16 16.77h64V320a143.3 143.3 0 0 0 10.39 53.69C96.74 396.64 80.18 422 80 463.34c0 8.74 6.62 16.3 15.36 16.65A16 16 0 0 0 112 464c0-27.66 9.1-44.71 26.17-61.32A144.37 144.37 0 0 0 220 459.42a16 16 0 0 0 20-15.49V192.45c0-8.61 6.62-16 15.23-16.43A16 16 0 0 1 272 192v251.93a16 16 0 0 0 20 15.49 144.4 144.4 0 0 0 81.82-56.74c17 16.54 26.09 33.52 26.17 60.95a16.27 16.27 0 0 0 15.1 16.37A16 16 0 0 0 432 464c0-41.68-16.6-67.23-42.39-90.31A143.3 143.3 0 0 0 400 320v-15.87h64a16 16 0 0 0 16-16.77c-.42-8.61-7.84-15.23-16.45-15.23"/><path d="m321.39 104 .32.09c13.57 3.8 25.07-10.55 18.2-22.85A95.86 95.86 0 0 0 256.21 32h-.42a95.87 95.87 0 0 0-84.19 50.13c-6.84 12.58 5.14 27 18.84 22.86 19.71-6 41.79-9.06 65.56-9.06 24.09 0 46.09 2.72 65.39 8.07"/></svg>';
|
|
374
|
+
|
|
372
375
|
// ../../node_modules/ionicons/dist/svg/bug-outline.svg
|
|
373
376
|
var bug_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M370 378c28.89 23.52 46 46.07 46 86M142 378c-28.89 23.52-46 46.06-46 86M384 208c28.89-23.52 32-56.07 32-96M128 206c-28.89-23.52-32-54.06-32-94M464 288.13h-80M128 288.13H48M256 192v256" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/><path d="M256 448c-70.4 0-128-57.6-128-128v-96.07c0-65.07 57.6-96 128-96h0c70.4 0 128 25.6 128 96V320c0 70.4-57.6 128-128 128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/><path d="M179.43 143.52a49.1 49.1 0 0 1-3.43-15.73A80 80 0 0 1 255.79 48h.42A80 80 0 0 1 336 127.79a41.9 41.9 0 0 1-3.12 14.3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32px"/></svg>';
|
|
374
377
|
|
|
375
|
-
// ../../node_modules/ionicons/dist/svg/bulb
|
|
376
|
-
var
|
|
378
|
+
// ../../node_modules/ionicons/dist/svg/bulb.svg
|
|
379
|
+
var bulb_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><path d="M288 464h-64a16 16 0 0 0 0 32h64a16 16 0 0 0 0-32M304 416h-96a16 16 0 0 0 0 32h96a16 16 0 0 0 0-32M369.42 62.69C339.35 32.58 299.07 16 256 16A159.62 159.62 0 0 0 96 176c0 46.62 17.87 90.23 49 119.64l4.36 4.09C167.37 316.57 192 339.64 192 360v24a16 16 0 0 0 16 16h24a8 8 0 0 0 8-8V274.82a8 8 0 0 0-5.13-7.47A130.7 130.7 0 0 1 208.71 253a16 16 0 1 1 18.58-26c7.4 5.24 21.65 13 28.71 13s21.31-7.78 28.73-13a16 16 0 0 1 18.56 26 130.7 130.7 0 0 1-26.16 14.32 8 8 0 0 0-5.13 7.47V392a8 8 0 0 0 8 8h24a16 16 0 0 0 16-16v-24c0-19.88 24.36-42.93 42.15-59.77l4.91-4.66C399.08 265 416 223.61 416 176a159.16 159.16 0 0 0-46.58-113.31"/></svg>';
|
|
377
380
|
|
|
378
381
|
// ../../node_modules/ionicons/dist/svg/calendar-outline.svg
|
|
379
382
|
var calendar_outline_default = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="ionicon"><rect width="416" height="384" x="48" y="80" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" rx="48"/><circle cx="296" cy="232" r="24"/><circle cx="376" cy="232" r="24"/><circle cx="296" cy="312" r="24"/><circle cx="376" cy="312" r="24"/><circle cx="136" cy="312" r="24"/><circle cx="216" cy="312" r="24"/><circle cx="136" cy="392" r="24"/><circle cx="216" cy="392" r="24"/><circle cx="296" cy="392" r="24"/><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M128 48v32M384 48v32"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32" d="M464 160H48"/></svg>';
|
|
@@ -457,8 +460,10 @@ var IKONER = Object.fromEntries(
|
|
|
457
460
|
Object.entries({
|
|
458
461
|
"arrow-back-outline": arrow_back_outline_default,
|
|
459
462
|
"brush-outline": brush_outline_default,
|
|
463
|
+
// Fylte varianter: bare på sporvalgets to kort (DD-63), der ikonet bærer stemningen.
|
|
464
|
+
bug: bug_default,
|
|
465
|
+
bulb: bulb_default,
|
|
460
466
|
"bug-outline": bug_outline_default,
|
|
461
|
-
"bulb-outline": bulb_outline_default,
|
|
462
467
|
"calendar-outline": calendar_outline_default,
|
|
463
468
|
"camera-outline": camera_outline_default,
|
|
464
469
|
"checkmark-circle-outline": checkmark_circle_outline_default,
|
|
@@ -504,6 +509,7 @@ function Ikon({
|
|
|
504
509
|
width: maal,
|
|
505
510
|
height: maal,
|
|
506
511
|
color: farge ?? tema.color.textPrimary,
|
|
512
|
+
fill: farge ?? tema.color.textPrimary,
|
|
507
513
|
accessibilityElementsHidden: true,
|
|
508
514
|
importantForAccessibility: "no"
|
|
509
515
|
}
|
|
@@ -511,11 +517,11 @@ function Ikon({
|
|
|
511
517
|
}
|
|
512
518
|
|
|
513
519
|
// src/widget/Felt.tsx
|
|
514
|
-
import { useMemo, useState } from "react";
|
|
520
|
+
import { useMemo as useMemo2, useState } from "react";
|
|
515
521
|
import { Pressable as Pressable2, ScrollView, Text as Text2, TextInput, View as View2 } from "react-native";
|
|
516
522
|
|
|
517
523
|
// src/widget/primitiver.tsx
|
|
518
|
-
import "react";
|
|
524
|
+
import { useMemo, useRef } from "react";
|
|
519
525
|
import { Pressable, Text, View } from "react-native";
|
|
520
526
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
521
527
|
function Btn({
|
|
@@ -528,10 +534,12 @@ function Btn({
|
|
|
528
534
|
accessibilityLabel,
|
|
529
535
|
grow,
|
|
530
536
|
testID,
|
|
531
|
-
busy
|
|
537
|
+
busy,
|
|
538
|
+
trykkForbiForelder
|
|
532
539
|
}) {
|
|
533
540
|
const tema = useTema();
|
|
534
541
|
const c = tema.color;
|
|
542
|
+
const forbi = useTrykkForbiForelder(onPress, !!disabled, tema.touch / 2);
|
|
535
543
|
const bakgrunn = variant === "primary" ? c.actionPrimary : variant === "secondary" ? c.surfaceRaised : "transparent";
|
|
536
544
|
const tekstfarge = variant === "primary" ? c.onActionPrimary : variant === "danger" ? c.danger : c.actionSecondaryText;
|
|
537
545
|
const kant = variant === "ghost" ? "transparent" : variant === "primary" ? c.actionPrimary : c.actionSecondaryBorder;
|
|
@@ -545,6 +553,7 @@ function Btn({
|
|
|
545
553
|
accessibilityState: { disabled: !!disabled, busy: !!busy },
|
|
546
554
|
disabled,
|
|
547
555
|
onPress,
|
|
556
|
+
...trykkForbiForelder ? forbi : {},
|
|
548
557
|
style: {
|
|
549
558
|
minHeight: tema.touch,
|
|
550
559
|
borderRadius: tema.radius.md,
|
|
@@ -577,6 +586,37 @@ function Btn({
|
|
|
577
586
|
hint ? /* @__PURE__ */ jsx2(Hint, { children: hint }) : null
|
|
578
587
|
] });
|
|
579
588
|
}
|
|
589
|
+
function useTrykkForbiForelder(onPress, laast, slingring) {
|
|
590
|
+
const start = useRef(null);
|
|
591
|
+
const fikkResponder = useRef(false);
|
|
592
|
+
const siste = useRef({ onPress, laast });
|
|
593
|
+
siste.current = { onPress, laast };
|
|
594
|
+
return useMemo(
|
|
595
|
+
() => ({
|
|
596
|
+
onPressIn: () => {
|
|
597
|
+
fikkResponder.current = true;
|
|
598
|
+
},
|
|
599
|
+
onTouchStart: (e) => {
|
|
600
|
+
start.current = { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY };
|
|
601
|
+
},
|
|
602
|
+
onTouchEnd: (e) => {
|
|
603
|
+
const s = start.current;
|
|
604
|
+
start.current = null;
|
|
605
|
+
const innenfor = s !== null && Math.abs(e.nativeEvent.pageX - s.x) <= slingring && Math.abs(e.nativeEvent.pageY - s.y) <= slingring;
|
|
606
|
+
setTimeout(() => {
|
|
607
|
+
const tatt = fikkResponder.current;
|
|
608
|
+
fikkResponder.current = false;
|
|
609
|
+
if (!tatt && innenfor && !siste.current.laast) siste.current.onPress?.();
|
|
610
|
+
}, 0);
|
|
611
|
+
},
|
|
612
|
+
onTouchCancel: () => {
|
|
613
|
+
start.current = null;
|
|
614
|
+
fikkResponder.current = false;
|
|
615
|
+
}
|
|
616
|
+
}),
|
|
617
|
+
[slingring]
|
|
618
|
+
);
|
|
619
|
+
}
|
|
580
620
|
function H({ children, sub }) {
|
|
581
621
|
const tema = useTema();
|
|
582
622
|
return /* @__PURE__ */ jsxs(View, { style: { gap: tema.space.xs }, children: [
|
|
@@ -711,7 +751,8 @@ function Banner({
|
|
|
711
751
|
// src/widget/tekster.ts
|
|
712
752
|
function saksnr(id) {
|
|
713
753
|
const i = id.indexOf("_");
|
|
714
|
-
|
|
754
|
+
const rest = i >= 0 ? id.slice(i + 1) : id;
|
|
755
|
+
return rest.length > 8 ? rest.slice(-4) : rest;
|
|
715
756
|
}
|
|
716
757
|
var stor = (s) => s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
717
758
|
var tekst = {
|
|
@@ -933,7 +974,7 @@ function Felt({
|
|
|
933
974
|
const full = brukt >= textMaxLength;
|
|
934
975
|
const visTeller = brukt >= textMaxLength * 0.8;
|
|
935
976
|
const uavklart = funn.find((f) => !beholdt.includes(f.match));
|
|
936
|
-
const linjer =
|
|
977
|
+
const linjer = useMemo2(() => {
|
|
937
978
|
const etiketter = {
|
|
938
979
|
screen: "Skjerm",
|
|
939
980
|
appVersion: "Appversjon",
|
|
@@ -1210,7 +1251,8 @@ function Felt({
|
|
|
1210
1251
|
disabled: forKort || sender,
|
|
1211
1252
|
busy: sender,
|
|
1212
1253
|
hint: forKort ? tekst.forKort(minTextLength) : harVedlegg ? tekst.sendHintMedBilde : void 0,
|
|
1213
|
-
onPress: onSend
|
|
1254
|
+
onPress: onSend,
|
|
1255
|
+
trykkForbiForelder: true
|
|
1214
1256
|
}
|
|
1215
1257
|
) })
|
|
1216
1258
|
] });
|
|
@@ -1242,7 +1284,21 @@ function Valg({ onVelg }) {
|
|
|
1242
1284
|
padding: tema.space.md
|
|
1243
1285
|
},
|
|
1244
1286
|
children: [
|
|
1245
|
-
/* @__PURE__ */ jsx4(
|
|
1287
|
+
/* @__PURE__ */ jsx4(
|
|
1288
|
+
View3,
|
|
1289
|
+
{
|
|
1290
|
+
testID: `spor-${spor}-ikonflate`,
|
|
1291
|
+
style: {
|
|
1292
|
+
width: 2 * tema.icon.inline + 2 * tema.space.md,
|
|
1293
|
+
height: 2 * tema.icon.inline + 2 * tema.space.md,
|
|
1294
|
+
borderRadius: tema.radius.pill,
|
|
1295
|
+
backgroundColor: tema.color.brandBg,
|
|
1296
|
+
alignItems: "center",
|
|
1297
|
+
justifyContent: "center"
|
|
1298
|
+
},
|
|
1299
|
+
children: /* @__PURE__ */ jsx4(Ikon, { navn: ikon, storrelse: "stor", farge: tema.color.brand })
|
|
1300
|
+
}
|
|
1301
|
+
),
|
|
1246
1302
|
/* @__PURE__ */ jsx4(
|
|
1247
1303
|
Text3,
|
|
1248
1304
|
{
|
|
@@ -1262,8 +1318,8 @@ function Valg({ onVelg }) {
|
|
|
1262
1318
|
return /* @__PURE__ */ jsxs3(View3, { style: { flex: 1, gap: tema.space.lg }, children: [
|
|
1263
1319
|
/* @__PURE__ */ jsx4(H, { children: tekst.valgTittel }),
|
|
1264
1320
|
/* @__PURE__ */ jsx4(View3, { style: { flex: 1, justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs3(View3, { style: { flexDirection: "row", gap: tema.space.md }, children: [
|
|
1265
|
-
flate("feil", "bug
|
|
1266
|
-
flate("onske", "bulb
|
|
1321
|
+
flate("feil", "bug", tekst.sporFeil, tekst.sporFeilUnder),
|
|
1322
|
+
flate("onske", "bulb", tekst.sporOnske, tekst.sporOnskeUnder)
|
|
1267
1323
|
] }) })
|
|
1268
1324
|
] });
|
|
1269
1325
|
}
|
|
@@ -1529,7 +1585,7 @@ function MineInnspill({
|
|
|
1529
1585
|
|
|
1530
1586
|
// src/widget/Skjermbilde.tsx
|
|
1531
1587
|
import { skaler, strokTilRekter, treffer, trykkTilRekt } from "@innspel/core";
|
|
1532
|
-
import { useCallback, useMemo as
|
|
1588
|
+
import { useCallback, useMemo as useMemo3, useRef as useRef2, useState as useState2 } from "react";
|
|
1533
1589
|
import { Image as Image2, Pressable as Pressable4, StyleSheet, Text as Text7, View as View7 } from "react-native";
|
|
1534
1590
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1535
1591
|
function Skjermbilde({
|
|
@@ -1548,13 +1604,13 @@ function Skjermbilde({
|
|
|
1548
1604
|
const [allTekst, setAllTekst] = useState2(false);
|
|
1549
1605
|
const [egne, setEgne] = useState2([]);
|
|
1550
1606
|
const [ramme, setRamme] = useState2(null);
|
|
1551
|
-
const strok =
|
|
1552
|
-
const visning =
|
|
1607
|
+
const strok = useRef2([]);
|
|
1608
|
+
const visning = useMemo3(() => {
|
|
1553
1609
|
if (!ramme) return null;
|
|
1554
1610
|
const s = Math.min(ramme.width / bilde.width, ramme.height / bilde.height);
|
|
1555
1611
|
return { width: Math.floor(bilde.width * s), height: Math.floor(bilde.height * s) };
|
|
1556
1612
|
}, [ramme, bilde.width, bilde.height]);
|
|
1557
|
-
const automasker =
|
|
1613
|
+
const automasker = useMemo3(
|
|
1558
1614
|
() => visning ? automaskerRot.map((r) => skaler(r, rotStorrelse, visning)) : [],
|
|
1559
1615
|
[automaskerRot, rotStorrelse, visning]
|
|
1560
1616
|
);
|
|
@@ -1771,7 +1827,7 @@ function Widget({
|
|
|
1771
1827
|
const tema = useTema();
|
|
1772
1828
|
const insets = useContext3(SafeAreaInsetsContext) ?? initialWindowMetrics?.insets ?? { top: 0, bottom: 0, left: 0, right: 0 };
|
|
1773
1829
|
const skjermbilde = useSkjermbilde();
|
|
1774
|
-
const previewRef =
|
|
1830
|
+
const previewRef = useRef3(null);
|
|
1775
1831
|
const [steg, setSteg] = useState3("valg");
|
|
1776
1832
|
const [spor, setSpor] = useState3("feil");
|
|
1777
1833
|
const [verdi, setVerdi] = useState3("");
|
|
@@ -1812,9 +1868,23 @@ function Widget({
|
|
|
1812
1868
|
setVedlegg(void 0);
|
|
1813
1869
|
setKomponerer(false);
|
|
1814
1870
|
}, []);
|
|
1871
|
+
const [mineDirekte, setMineDirekte] = useState3(false);
|
|
1872
|
+
const [stegForMine, setStegForMine] = useState3("valg");
|
|
1873
|
+
const stegRef = useRef3(steg);
|
|
1874
|
+
stegRef.current = steg;
|
|
1875
|
+
const harUtkast = verdi.trim().length > 0 || vedlegg !== void 0;
|
|
1815
1876
|
const lukk = useCallback2(() => {
|
|
1877
|
+
onLukk();
|
|
1878
|
+
if (stegRef.current === "mine" && mineDirekte) {
|
|
1879
|
+
setSteg(stegForMine);
|
|
1880
|
+
setMineDirekte(false);
|
|
1881
|
+
}
|
|
1882
|
+
}, [onLukk, mineDirekte, stegForMine]);
|
|
1883
|
+
const lukkOgNullstill = useCallback2(() => {
|
|
1816
1884
|
onLukk();
|
|
1817
1885
|
nullstill();
|
|
1886
|
+
setMineDirekte(false);
|
|
1887
|
+
setStegForMine("valg");
|
|
1818
1888
|
}, [onLukk, nullstill]);
|
|
1819
1889
|
useEffect(() => {
|
|
1820
1890
|
if (!synlig) return;
|
|
@@ -1824,8 +1894,8 @@ function Widget({
|
|
|
1824
1894
|
if (!client.isAnonymous) {
|
|
1825
1895
|
void client.subjects.submissions().then(setMine).catch(() => void 0);
|
|
1826
1896
|
}
|
|
1827
|
-
if (apneOpsjoner?.view === "mine" && !client.isAnonymous) void visMine();
|
|
1828
|
-
else if (apneOpsjoner?.track) velgSpor(apneOpsjoner.track);
|
|
1897
|
+
if (apneOpsjoner?.view === "mine" && !client.isAnonymous) void visMine(true);
|
|
1898
|
+
else if (apneOpsjoner?.track && !harUtkast) void velgSpor(apneOpsjoner.track);
|
|
1829
1899
|
}, [synlig]);
|
|
1830
1900
|
const hentKort = useCallback2(async () => {
|
|
1831
1901
|
setLasterKort(true);
|
|
@@ -1923,6 +1993,11 @@ function Widget({
|
|
|
1923
1993
|
}, []);
|
|
1924
1994
|
const gaaTilbake = useCallback2(() => {
|
|
1925
1995
|
setFeil(void 0);
|
|
1996
|
+
if (steg === "mine") {
|
|
1997
|
+
if (mineDirekte) lukk();
|
|
1998
|
+
else setSteg("valg");
|
|
1999
|
+
return;
|
|
2000
|
+
}
|
|
1926
2001
|
if (steg === "skjermbilde") {
|
|
1927
2002
|
setBilde(void 0);
|
|
1928
2003
|
setAutomasker([]);
|
|
@@ -1934,7 +2009,12 @@ function Widget({
|
|
|
1934
2009
|
return;
|
|
1935
2010
|
}
|
|
1936
2011
|
setSteg("valg");
|
|
1937
|
-
}, [steg, spor, kort.length]);
|
|
2012
|
+
}, [steg, spor, kort.length, mineDirekte, lukk]);
|
|
2013
|
+
const androidTilbake = useCallback2(() => {
|
|
2014
|
+
if (steg === "valg") lukk();
|
|
2015
|
+
else if (steg === "kvittering") lukkOgNullstill();
|
|
2016
|
+
else gaaTilbake();
|
|
2017
|
+
}, [steg, lukk, lukkOgNullstill, gaaTilbake]);
|
|
1938
2018
|
const send = useCallback2(async () => {
|
|
1939
2019
|
setSender(true);
|
|
1940
2020
|
setFeil(void 0);
|
|
@@ -1981,7 +2061,13 @@ function Widget({
|
|
|
1981
2061
|
},
|
|
1982
2062
|
[client]
|
|
1983
2063
|
);
|
|
1984
|
-
const visMine = useCallback2(async () => {
|
|
2064
|
+
const visMine = useCallback2(async (direkte = false) => {
|
|
2065
|
+
if (direkte) {
|
|
2066
|
+
if (stegRef.current !== "mine") setStegForMine(stegRef.current);
|
|
2067
|
+
} else {
|
|
2068
|
+
setStegForMine("valg");
|
|
2069
|
+
}
|
|
2070
|
+
setMineDirekte(direkte);
|
|
1985
2071
|
setSteg("mine");
|
|
1986
2072
|
setLasterMine(true);
|
|
1987
2073
|
try {
|
|
@@ -1992,13 +2078,18 @@ function Widget({
|
|
|
1992
2078
|
setLasterMine(false);
|
|
1993
2079
|
}
|
|
1994
2080
|
}, [client]);
|
|
2081
|
+
const nyttFraMine = useCallback2(() => {
|
|
2082
|
+
setMineDirekte(false);
|
|
2083
|
+
if (harUtkast) setSteg(stegForMine);
|
|
2084
|
+
else nullstill();
|
|
2085
|
+
}, [harUtkast, stegForMine, nullstill]);
|
|
1995
2086
|
return /* @__PURE__ */ jsx9(
|
|
1996
2087
|
Modal,
|
|
1997
2088
|
{
|
|
1998
2089
|
visible: synlig,
|
|
1999
2090
|
transparent: true,
|
|
2000
2091
|
animationType: "slide",
|
|
2001
|
-
onRequestClose:
|
|
2092
|
+
onRequestClose: androidTilbake,
|
|
2002
2093
|
accessibilityViewIsModal: true,
|
|
2003
2094
|
children: /* @__PURE__ */ jsx9(
|
|
2004
2095
|
KeyboardAvoidingView,
|
|
@@ -2036,7 +2127,7 @@ function Widget({
|
|
|
2036
2127
|
testID: "lukk",
|
|
2037
2128
|
accessibilityRole: "button",
|
|
2038
2129
|
accessibilityLabel: tekst.lukk,
|
|
2039
|
-
onPress: lukk,
|
|
2130
|
+
onPress: steg === "kvittering" ? lukkOgNullstill : lukk,
|
|
2040
2131
|
style: { minWidth: tema.touch, minHeight: tema.touch, alignItems: "center", justifyContent: "center" },
|
|
2041
2132
|
children: /* @__PURE__ */ jsx9(Ikon, { navn: "close-outline", farge: tema.color.textSecondary })
|
|
2042
2133
|
}
|
|
@@ -2054,7 +2145,7 @@ function Widget({
|
|
|
2054
2145
|
ikon: "list-outline",
|
|
2055
2146
|
label: mine.length > 0 ? tekst.mineMedAntall(mine.length) : tekst.mineTittel,
|
|
2056
2147
|
accessibilityLabel: mine.length > 0 ? tekst.mineEtikett(mine.length) : tekst.mineTittel,
|
|
2057
|
-
onPress: visMine
|
|
2148
|
+
onPress: () => void visMine()
|
|
2058
2149
|
}
|
|
2059
2150
|
) : null
|
|
2060
2151
|
] }) : null,
|
|
@@ -2118,7 +2209,7 @@ function Widget({
|
|
|
2118
2209
|
...kvittering.nr ? { saksnummer: kvittering.nr } : {},
|
|
2119
2210
|
...kvittering.vedlegg ? { vedlegg: kvittering.vedlegg } : {},
|
|
2120
2211
|
...kvittering.frist ? { frist: kvittering.frist } : {},
|
|
2121
|
-
onLukk:
|
|
2212
|
+
onLukk: lukkOgNullstill
|
|
2122
2213
|
}
|
|
2123
2214
|
) : null,
|
|
2124
2215
|
steg === "mine" ? /* @__PURE__ */ jsx9(
|
|
@@ -2127,7 +2218,7 @@ function Widget({
|
|
|
2127
2218
|
rader: mine,
|
|
2128
2219
|
laster: lasterMine,
|
|
2129
2220
|
...tenantName ? { tenantName } : {},
|
|
2130
|
-
onNytt:
|
|
2221
|
+
onNytt: nyttFraMine
|
|
2131
2222
|
}
|
|
2132
2223
|
) : null
|
|
2133
2224
|
]
|
|
@@ -2170,9 +2261,9 @@ function InnspelProvider({
|
|
|
2170
2261
|
}) {
|
|
2171
2262
|
const [synlig, setSynlig] = useState4(false);
|
|
2172
2263
|
const [apneOpsjoner, setApneOpsjoner] = useState4();
|
|
2173
|
-
const registrert =
|
|
2174
|
-
const rootRef =
|
|
2175
|
-
const privat =
|
|
2264
|
+
const registrert = useRef4(false);
|
|
2265
|
+
const rootRef = useRef4(null);
|
|
2266
|
+
const privat = useMemo4(createPrivateRegistry, []);
|
|
2176
2267
|
const open = useCallback3(
|
|
2177
2268
|
async (options) => {
|
|
2178
2269
|
setApneOpsjoner(options);
|
|
@@ -2185,9 +2276,9 @@ function InnspelProvider({
|
|
|
2185
2276
|
client.registerPresenter({ open });
|
|
2186
2277
|
registrert.current = true;
|
|
2187
2278
|
}
|
|
2188
|
-
const tema =
|
|
2189
|
-
const verdi =
|
|
2190
|
-
const skjermbilde =
|
|
2279
|
+
const tema = useMemo4(() => byggTema(theme, colorScheme), [theme, colorScheme]);
|
|
2280
|
+
const verdi = useMemo4(() => ({ client, open, close }), [client, open, close]);
|
|
2281
|
+
const skjermbilde = useMemo4(
|
|
2191
2282
|
() => ({ adapter: screenshot ?? null, rootRef, privat }),
|
|
2192
2283
|
[screenshot, privat]
|
|
2193
2284
|
);
|
|
@@ -2217,11 +2308,11 @@ function useInnspel() {
|
|
|
2217
2308
|
}
|
|
2218
2309
|
|
|
2219
2310
|
// src/InnspelPrivate.tsx
|
|
2220
|
-
import { useEffect as useEffect2, useRef as
|
|
2311
|
+
import { useEffect as useEffect2, useRef as useRef5 } from "react";
|
|
2221
2312
|
import { View as View10 } from "react-native";
|
|
2222
2313
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2223
2314
|
function InnspelPrivate({ children, style }) {
|
|
2224
|
-
const ref =
|
|
2315
|
+
const ref = useRef5(null);
|
|
2225
2316
|
const kontekst = useSkjermbilde();
|
|
2226
2317
|
const registrer = kontekst?.privat.register;
|
|
2227
2318
|
useEffect2(() => {
|