@appilots/sdk 0.7.0 → 0.10.0
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 +46 -4
- package/dist/.build-meta.json +5 -0
- package/dist/{chunk-KYFAXT6V.js → chunk-2GCWCPSD.js} +19 -16
- package/dist/{chunk-R4D34FEW.mjs → chunk-AHHDOUVX.mjs} +2151 -333
- package/dist/{chunk-DR75QTYK.mjs → chunk-IHPLS5FE.mjs} +16 -13
- package/dist/{chunk-HFRIB4YN.js → chunk-VX7AL4SA.js} +1049 -1162
- package/dist/{chunk-KUFWRJC4.mjs → chunk-XHR65V2W.mjs} +831 -949
- package/dist/{chunk-DZ7QRFHD.js → chunk-YB77RYCC.js} +2178 -332
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +11 -11
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-nI-s3Exg.d.mts → index-BPZ0j71S.d.mts} +315 -15
- package/dist/{index-nI-s3Exg.d.ts → index-BPZ0j71S.d.ts} +315 -15
- package/dist/index.d.mts +325 -22
- package/dist/index.d.ts +325 -22
- package/dist/index.js +340 -227
- package/dist/index.mjs +274 -173
- package/dist/navigation/index.d.mts +171 -3
- package/dist/navigation/index.d.ts +171 -3
- package/dist/navigation/index.js +13 -13
- package/dist/navigation/index.mjs +2 -2
- package/metro.d.ts +16 -1
- package/metro.js +104 -10
- package/package.json +16 -6
- package/dist/registerScreen-D1oGm28T.d.mts +0 -159
- package/dist/registerScreen-D1oGm28T.d.ts +0 -159
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAppilotsContext, setNavigationRef, setCurrentScreen } from './chunk-
|
|
1
|
+
import { useAppilotsContext, setNavigationRef, appilotsDebugLog, setCurrentScreen } from './chunk-AHHDOUVX.mjs';
|
|
2
2
|
import React, { useRef, useCallback, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function getActiveRouteName(state) {
|
|
@@ -11,21 +11,24 @@ function getActiveRouteName(state) {
|
|
|
11
11
|
function AppilotsNavigationContainer({ children }) {
|
|
12
12
|
const { emit } = useAppilotsContext();
|
|
13
13
|
const internalRef = useRef(null);
|
|
14
|
-
const handleRef = useCallback(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const handleRef = useCallback(
|
|
15
|
+
(instance) => {
|
|
16
|
+
internalRef.current = instance;
|
|
17
|
+
setNavigationRef(instance);
|
|
18
|
+
const childRef = children.ref;
|
|
19
|
+
if (typeof childRef === "function") childRef(instance);
|
|
20
|
+
else if (childRef && typeof childRef === "object") childRef.current = instance;
|
|
21
|
+
if (instance) {
|
|
22
|
+
appilotsDebugLog("NavigationContainer ref captured");
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
[children]
|
|
26
|
+
);
|
|
24
27
|
const handleStateChange = useCallback(
|
|
25
28
|
(state) => {
|
|
26
29
|
const routeName = getActiveRouteName(state);
|
|
27
30
|
if (routeName) {
|
|
28
|
-
|
|
31
|
+
appilotsDebugLog(`Screen changed \u2192 "${routeName}"`);
|
|
29
32
|
setCurrentScreen(routeName);
|
|
30
33
|
emit({
|
|
31
34
|
type: "navigation:change",
|
|
@@ -41,7 +44,7 @@ function AppilotsNavigationContainer({ children }) {
|
|
|
41
44
|
const timer = setTimeout(() => {
|
|
42
45
|
const route = internalRef.current?.getCurrentRoute?.();
|
|
43
46
|
if (route?.name) {
|
|
44
|
-
|
|
47
|
+
appilotsDebugLog(`Initial screen \u2192 "${route.name}"`);
|
|
45
48
|
setCurrentScreen(route.name);
|
|
46
49
|
emit({
|
|
47
50
|
type: "navigation:change",
|