react-native-acoustic-connect-beta 18.0.13 → 18.0.14
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/Examples/SampleUI/src/index.native.tsx +1 -0
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
- package/ios/HybridAcousticConnectRN.swift +4 -4
- package/lib/commonjs/components/Connect.js +28 -30
- package/lib/commonjs/components/Connect.js.map +1 -1
- package/lib/module/components/Connect.js +29 -32
- package/lib/module/components/Connect.js.map +1 -1
- package/lib/typescript/src/components/Connect.d.ts +1 -2
- package/lib/typescript/src/components/Connect.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/ConnectConfig.json +1 -1
- package/src/components/Connect.tsx +87 -101
|
@@ -252,6 +252,7 @@ export default function PaperExample() {
|
|
|
252
252
|
onStateChange={(state) =>
|
|
253
253
|
AsyncStorage.setItem(PERSISTENCE_KEY, JSON.stringify(state))
|
|
254
254
|
}
|
|
255
|
+
onReady={() => console.log('NavigationContainer is ready!')}
|
|
255
256
|
>
|
|
256
257
|
<SafeAreaInsetsContext.Consumer>
|
|
257
258
|
{(insets) => {
|
|
@@ -37,10 +37,10 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
37
37
|
func load() {
|
|
38
38
|
DispatchQueue.main.async {
|
|
39
39
|
self.loadConnectConfig()
|
|
40
|
-
EOApplicationHelper().setConfigItem(kConfigurableItemSetGestureDetector, value: "false", forModuleName: kTLFCoreModule)
|
|
41
|
-
EOApplicationHelper().setConfigItem(kConfigurableItemLogViewLayoutOnScreenTransition, value: "false", forModuleName: kTLFCoreModule)
|
|
40
|
+
// EOApplicationHelper().setConfigItem(kConfigurableItemSetGestureDetector, value: "false", forModuleName: kTLFCoreModule)
|
|
41
|
+
// EOApplicationHelper().setConfigItem(kConfigurableItemLogViewLayoutOnScreenTransition, value: "false", forModuleName: kTLFCoreModule)
|
|
42
|
+
ConnectApplicationHelper().isReactNative(true, wrapNavigationContainer: true)
|
|
42
43
|
ConnectApplicationHelper().enableFramework()
|
|
43
|
-
ConnectApplicationHelper().isReactNative(true)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -280,7 +280,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
280
280
|
/// - Parameter logicalPageName: Page name or title e.g. "Login View Controller"; Must not be empty.
|
|
281
281
|
/// - Returns: Boolean value will return whether it was able to log the screenview event.
|
|
282
282
|
func setCurrentScreenName(logicalPageName: String) throws -> Bool {
|
|
283
|
-
let result = ConnectApplicationHelper().
|
|
283
|
+
let result = ConnectApplicationHelper().setCurrentScreenName(logicalPageName)
|
|
284
284
|
return result
|
|
285
285
|
}
|
|
286
286
|
|
|
@@ -20,59 +20,57 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
20
20
|
* prohibited.
|
|
21
21
|
********************************************************************************************/
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
children,
|
|
25
|
-
captureKeyboardEvents,
|
|
26
|
-
navigationRef
|
|
27
|
-
}, ref) => {
|
|
28
|
-
const navigation = navigationRef || (0, _react.useRef)(null);
|
|
23
|
+
// Use type-only import for LayoutChangeEvent
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ref(navigation.current);
|
|
36
|
-
}
|
|
37
|
-
}, [ref]);
|
|
25
|
+
const Connect = ({
|
|
26
|
+
children,
|
|
27
|
+
captureKeyboardEvents
|
|
28
|
+
}) => {
|
|
29
|
+
const navigation = children.ref; // Type assertion for children with ref
|
|
38
30
|
const currentRoute = (0, _react.useRef)(undefined);
|
|
39
31
|
const initial = (0, _react.useRef)(false);
|
|
40
32
|
(0, _react.useEffect)(() => {
|
|
41
33
|
_TLTRN.default.interceptKeyboardEvents(captureKeyboardEvents);
|
|
42
34
|
}, [captureKeyboardEvents]);
|
|
43
35
|
(0, _react.useEffect)(() => {
|
|
44
|
-
if (!navigation
|
|
45
|
-
console.warn("Connect: The Connect component's
|
|
36
|
+
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
37
|
+
console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
|
|
46
38
|
return;
|
|
47
39
|
}
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
|
|
41
|
+
// Listen for the 'state' event to track navigation state changes
|
|
42
|
+
const unsubscribeState = navigation.current.addListener("state", () => {
|
|
43
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
50
44
|
console.log("State change - ", currentRoute.current);
|
|
51
|
-
if (_reactNative.Platform.OS === "ios" && currentRoute.current) {
|
|
45
|
+
if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
52
46
|
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
53
47
|
} else if (_reactNative.Platform.OS === "android") {
|
|
54
48
|
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
55
49
|
_TLTRN.default.logScreenLayout(currentRoute.current);
|
|
56
50
|
}
|
|
57
51
|
});
|
|
58
|
-
|
|
52
|
+
|
|
53
|
+
// Cleanup listeners when the component unmounts or dependencies change
|
|
54
|
+
return () => {
|
|
55
|
+
unsubscribeState();
|
|
56
|
+
};
|
|
59
57
|
}, [navigation]);
|
|
60
58
|
const onStartShouldSetResponderCapture = (0, _react.useCallback)(event => {
|
|
61
|
-
currentRoute.current = extractName(navigation);
|
|
62
|
-
if (currentRoute.current) {
|
|
59
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
60
|
+
if (currentRoute && currentRoute.current) {
|
|
63
61
|
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
64
62
|
}
|
|
65
63
|
_TLTRN.default.logClickEvent(event);
|
|
66
|
-
return false;
|
|
67
|
-
}, [
|
|
64
|
+
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
65
|
+
}, []);
|
|
68
66
|
const onLayout = (0, _react.useCallback)(event => {
|
|
69
67
|
if (initial.current) {
|
|
70
68
|
return false;
|
|
71
69
|
}
|
|
72
70
|
initial.current = true;
|
|
73
71
|
console.log("event - ", event.nativeEvent);
|
|
74
|
-
currentRoute.current = navigation.current
|
|
75
|
-
if (_reactNative.Platform.OS === "ios" && currentRoute.current) {
|
|
72
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
73
|
+
if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
76
74
|
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
77
75
|
} else if (_reactNative.Platform.OS === "android") {
|
|
78
76
|
_TLTRN.default.logScreenLayout(currentRoute.current);
|
|
@@ -85,16 +83,16 @@ const Connect = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
85
83
|
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
86
84
|
children: children
|
|
87
85
|
});
|
|
88
|
-
}
|
|
86
|
+
};
|
|
89
87
|
function extractName(navigation) {
|
|
90
|
-
const routeParams = navigation.current
|
|
88
|
+
const routeParams = navigation.current.getCurrentRoute()?.params;
|
|
91
89
|
if (routeParams) {
|
|
92
90
|
const {
|
|
93
91
|
name
|
|
94
92
|
} = routeParams;
|
|
95
|
-
return name || "";
|
|
93
|
+
return name ? name : navigation.current?.getCurrentRoute()?.name || "";
|
|
96
94
|
}
|
|
97
|
-
return
|
|
95
|
+
return "";
|
|
98
96
|
}
|
|
99
97
|
var _default = exports.default = Connect;
|
|
100
98
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TLTRN","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Connect","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TLTRN","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Connect","children","captureKeyboardEvents","navigation","ref","currentRoute","useRef","undefined","initial","useEffect","TLTRN","interceptKeyboardEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","Platform","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","useCallback","event","logClickEvent","onLayout","nativeEvent","jsx","View","style","styles","connect_main","routeParams","params","_default","exports","StyleSheet","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,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
|
|
9
9
|
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
10
10
|
* prohibited.
|
|
11
11
|
********************************************************************************************/
|
|
12
|
-
import React, { useCallback, useEffect, useRef
|
|
12
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
13
13
|
import { View, StyleSheet, Platform } from "react-native";
|
|
14
|
-
import
|
|
14
|
+
// Use type-only import for LayoutChangeEvent
|
|
15
|
+
import TLTRN from '../TLTRN';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
const Connect =
|
|
17
|
+
const Connect = ({
|
|
17
18
|
children,
|
|
18
|
-
captureKeyboardEvents
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const navigation = navigationRef || useRef(null);
|
|
22
|
-
|
|
23
|
-
// Handle forwarded ref
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (ref && typeof ref === "object" && ref !== null) {
|
|
26
|
-
navigation.current = ref.current;
|
|
27
|
-
} else if (typeof ref === "function") {
|
|
28
|
-
ref(navigation.current);
|
|
29
|
-
}
|
|
30
|
-
}, [ref]);
|
|
19
|
+
captureKeyboardEvents
|
|
20
|
+
}) => {
|
|
21
|
+
const navigation = children.ref; // Type assertion for children with ref
|
|
31
22
|
const currentRoute = useRef(undefined);
|
|
32
23
|
const initial = useRef(false);
|
|
33
24
|
useEffect(() => {
|
|
34
25
|
TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
35
26
|
}, [captureKeyboardEvents]);
|
|
36
27
|
useEffect(() => {
|
|
37
|
-
if (!navigation
|
|
38
|
-
console.warn("Connect: The Connect component's
|
|
28
|
+
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
29
|
+
console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
|
|
39
30
|
return;
|
|
40
31
|
}
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
|
|
33
|
+
// Listen for the 'state' event to track navigation state changes
|
|
34
|
+
const unsubscribeState = navigation.current.addListener("state", () => {
|
|
35
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
43
36
|
console.log("State change - ", currentRoute.current);
|
|
44
|
-
if (Platform.OS === "ios" && currentRoute.current) {
|
|
37
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
45
38
|
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
46
39
|
} else if (Platform.OS === "android") {
|
|
47
40
|
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
48
41
|
TLTRN.logScreenLayout(currentRoute.current);
|
|
49
42
|
}
|
|
50
43
|
});
|
|
51
|
-
|
|
44
|
+
|
|
45
|
+
// Cleanup listeners when the component unmounts or dependencies change
|
|
46
|
+
return () => {
|
|
47
|
+
unsubscribeState();
|
|
48
|
+
};
|
|
52
49
|
}, [navigation]);
|
|
53
50
|
const onStartShouldSetResponderCapture = useCallback(event => {
|
|
54
|
-
currentRoute.current = extractName(navigation);
|
|
55
|
-
if (currentRoute.current) {
|
|
51
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
52
|
+
if (currentRoute && currentRoute.current) {
|
|
56
53
|
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
57
54
|
}
|
|
58
55
|
TLTRN.logClickEvent(event);
|
|
59
|
-
return false;
|
|
60
|
-
}, [
|
|
56
|
+
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
57
|
+
}, []);
|
|
61
58
|
const onLayout = useCallback(event => {
|
|
62
59
|
if (initial.current) {
|
|
63
60
|
return false;
|
|
64
61
|
}
|
|
65
62
|
initial.current = true;
|
|
66
63
|
console.log("event - ", event.nativeEvent);
|
|
67
|
-
currentRoute.current = navigation.current
|
|
68
|
-
if (Platform.OS === "ios" && currentRoute.current) {
|
|
64
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
65
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
69
66
|
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
70
67
|
} else if (Platform.OS === "android") {
|
|
71
68
|
TLTRN.logScreenLayout(currentRoute.current);
|
|
@@ -78,16 +75,16 @@ const Connect = /*#__PURE__*/forwardRef(({
|
|
|
78
75
|
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
79
76
|
children: children
|
|
80
77
|
});
|
|
81
|
-
}
|
|
78
|
+
};
|
|
82
79
|
function extractName(navigation) {
|
|
83
|
-
const routeParams = navigation.current
|
|
80
|
+
const routeParams = navigation.current.getCurrentRoute()?.params;
|
|
84
81
|
if (routeParams) {
|
|
85
82
|
const {
|
|
86
83
|
name
|
|
87
84
|
} = routeParams;
|
|
88
|
-
return name || "";
|
|
85
|
+
return name ? name : navigation.current?.getCurrentRoute()?.name || "";
|
|
89
86
|
}
|
|
90
|
-
return
|
|
87
|
+
return "";
|
|
91
88
|
}
|
|
92
89
|
export default Connect;
|
|
93
90
|
const styles = StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useRef","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","TLTRN","jsx","_jsx","Connect","children","captureKeyboardEvents","navigation","ref","currentRoute","undefined","initial","interceptKeyboardEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","event","logClickEvent","onLayout","nativeEvent","style","styles","connect_main","routeParams","params","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAoB,OAAO;AACzE,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAuC,cAAc;AACjC;AACvD,OAAOC,KAAK,MAAM,UAAU;AAAC,SAAAC,GAAA,IAA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;IAC3BJ,QAAQ,EAAEA,QAAS;IACnBH,gCAAgC,EAAEA,gCAAiC;IAAApB,QAAA,EAElEA;EAAQ,CACP,CAAC;AAEf,CAAC;AAED,SAASc,WAAWA,CAACZ,UAAe,EAAU;EAC1C,MAAM0B,WAAW,GAAG1B,UAAU,CAACM,OAAO,CAACE,eAAe,CAAC,CAAC,EAAEmB,MAAM;EAChE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEb;IAAK,CAAC,GAAGa,WAAW;IAC5B,OAAOb,IAAI,GAAGA,IAAI,GAAGb,UAAU,CAACM,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAEA,eAAehB,OAAO;AAEtB,MAAM2B,MAAM,GAAGhC,UAAU,CAACoC,MAAM,CAAC;EAC7BH,YAAY,EAAE;IACVI,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -11,8 +11,7 @@ import React from "react";
|
|
|
11
11
|
interface ConnectProps {
|
|
12
12
|
children: React.ReactNode;
|
|
13
13
|
captureKeyboardEvents: boolean;
|
|
14
|
-
navigationRef?: React.RefObject<any>;
|
|
15
14
|
}
|
|
16
|
-
declare const Connect: React.
|
|
15
|
+
declare const Connect: React.FC<ConnectProps>;
|
|
17
16
|
export default Connect;
|
|
18
17
|
//# sourceMappingURL=Connect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAqD,MAAM,OAAO,CAAC;AAK1E,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAqD,MAAM,OAAO,CAAC;AAK1E,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA2EnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"source": "src/index",
|
|
193
193
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
194
194
|
"types": "./lib/typescript/src/index.d.ts",
|
|
195
|
-
"version": "18.0.
|
|
195
|
+
"version": "18.0.14",
|
|
196
196
|
"workspaces": [
|
|
197
197
|
"example"
|
|
198
198
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "10.4.
|
|
3
|
+
"AndroidVersion": "10.4.59",
|
|
4
4
|
"AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
5
5
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
6
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
|
@@ -9,118 +9,104 @@
|
|
|
9
9
|
********************************************************************************************/
|
|
10
10
|
import React, { useCallback, useEffect, useRef, forwardRef } from "react";
|
|
11
11
|
import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
|
|
12
|
-
import type { LayoutChangeEvent } from "react-native";
|
|
13
|
-
import TLTRN from
|
|
12
|
+
import type { LayoutChangeEvent } from "react-native"; // Use type-only import for LayoutChangeEvent
|
|
13
|
+
import TLTRN from '../TLTRN';
|
|
14
14
|
|
|
15
15
|
interface ConnectProps {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
captureKeyboardEvents: boolean;
|
|
18
|
-
navigationRef?: React.RefObject<any>;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
const Connect =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
[navigation]
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<View
|
|
102
|
-
style={styles.connect_main}
|
|
103
|
-
onLayout={onLayout}
|
|
104
|
-
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
105
|
-
>
|
|
106
|
-
{children}
|
|
107
|
-
</View>
|
|
108
|
-
);
|
|
109
|
-
});
|
|
20
|
+
const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents }) => {
|
|
21
|
+
const navigation = (children as any).ref; // Type assertion for children with ref
|
|
22
|
+
const currentRoute = useRef<string | undefined>(undefined);
|
|
23
|
+
const initial = useRef<boolean>(false);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
27
|
+
}, [captureKeyboardEvents]);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (
|
|
31
|
+
!navigation ||
|
|
32
|
+
typeof navigation.current.addListener !== "function" ||
|
|
33
|
+
typeof navigation.current.getCurrentRoute !== "function"
|
|
34
|
+
) {
|
|
35
|
+
console.warn(
|
|
36
|
+
"Connect: The Connect component's first child must be a NavigationContainer with a ref."
|
|
37
|
+
);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Listen for the 'state' event to track navigation state changes
|
|
42
|
+
const unsubscribeState = navigation.current.addListener("state", () => {
|
|
43
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
44
|
+
console.log("State change - ", currentRoute.current);
|
|
45
|
+
|
|
46
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
47
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
48
|
+
} else if (Platform.OS === "android") {
|
|
49
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
50
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Cleanup listeners when the component unmounts or dependencies change
|
|
55
|
+
return () => {
|
|
56
|
+
unsubscribeState();
|
|
57
|
+
};
|
|
58
|
+
}, [navigation]);
|
|
59
|
+
|
|
60
|
+
const onStartShouldSetResponderCapture = useCallback((event: any) => {
|
|
61
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
62
|
+
if (currentRoute && currentRoute.current) {
|
|
63
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
64
|
+
}
|
|
65
|
+
TLTRN.logClickEvent(event);
|
|
66
|
+
return false; // Must be false; true means this component becomes the touch responder and events don't bubble
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
const onLayout = useCallback((event: LayoutChangeEvent) => {
|
|
70
|
+
if (initial.current) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
initial.current = true;
|
|
74
|
+
|
|
75
|
+
console.log("event - ", event.nativeEvent);
|
|
76
|
+
|
|
77
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
78
|
+
if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
|
|
79
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
80
|
+
} else if (Platform.OS === "android") {
|
|
81
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
82
|
+
}
|
|
83
|
+
return true
|
|
84
|
+
}, [navigation]);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<View
|
|
88
|
+
style={styles.connect_main}
|
|
89
|
+
onLayout={onLayout}
|
|
90
|
+
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</View>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
110
96
|
|
|
111
97
|
function extractName(navigation: any): string {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
98
|
+
const routeParams = navigation.current.getCurrentRoute()?.params;
|
|
99
|
+
if (routeParams) {
|
|
100
|
+
const { name } = routeParams;
|
|
101
|
+
return name ? name : navigation.current?.getCurrentRoute()?.name || "";
|
|
102
|
+
}
|
|
103
|
+
return "";
|
|
118
104
|
}
|
|
119
105
|
|
|
120
106
|
export default Connect;
|
|
121
107
|
|
|
122
108
|
const styles = StyleSheet.create({
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
connect_main: {
|
|
110
|
+
flex: 1,
|
|
111
|
+
},
|
|
126
112
|
});
|