react-native-acoustic-connect-beta 18.0.20 → 18.0.21

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.
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "11.0.8-beta",
27
+ "LibraryVersion": "11.0.9-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -1,4 +1,4 @@
1
- #Fri Apr 24 00:36:32 PDT 2026
1
+ #Fri Apr 24 05:22:50 PDT 2026
2
2
  UseWhiteList=true
3
3
  PrintScreen=3
4
4
  UseRandomSample=false
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "10.4.27-beta",
27
+ "LibraryVersion": "10.4.28-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -14,64 +14,30 @@ import Foundation
14
14
  import Connect
15
15
  import NitroModules
16
16
 
17
- // EOCore and Tealeaf ship as separate modules in the Release iOS SDK and in the
18
- // Debug SDK before 2.1.2. From Debug 2.1.2 onward they are merged into Connect
19
- // and these modules are no longer on the search path — so we import them
20
- // conditionally to support both variants from the same source.
21
- #if canImport(EOCore)
22
- import EOCore
23
- #endif
24
- #if canImport(Tealeaf)
25
- import Tealeaf
26
- #endif
27
-
28
- // In the unified SDK, module-name constants were dropped along with the modules
29
- // themselves. The replacement helper (`ConnectApplicationHelper`) ignores the
30
- // module name — a single config store holds all keys. We still keep the old
31
- // names so existing call sites compile unchanged on both variants.
32
- #if !canImport(EOCore)
33
- private let kEOCoreModule = "EOCore"
34
- private let kTLFCoreModule = "TLFCoreModule"
35
- #endif
36
-
37
- // Cross-SDK bridge for the config-item set/get API. On the old SDK this calls
38
- // through `EOApplicationHelper` with a module name; on the unified SDK it calls
39
- // through `ConnectApplicationHelper` and the module name is ignored.
17
+ // Single compat entry point for the config-item store. Works against every
18
+ // shipping iOS SDK variant (Release with separate EOCore/Tealeaf, current merged
19
+ // Debug 2.1.2, future merged-only) because `ConnectApplicationHelper` ships with
20
+ // each of them. Not importing `EOCore`/`Tealeaf` avoids a link dependency on
21
+ // frameworks that aren't always packaged into the app bundle.
40
22
  private enum ConnectConfigStore {
41
23
  @discardableResult
42
- static func set(_ key: String, value: Any, forModule moduleName: String) -> Bool {
43
- #if canImport(EOCore)
44
- return EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: moduleName)
45
- #else
24
+ static func set(_ key: String, value: Any) -> Bool {
46
25
  return ConnectApplicationHelper.sharedInstance().setConfigurableItem(key, value: value)
47
- #endif
48
26
  }
49
27
 
50
- static func bool(forKey key: String, default def: Bool, moduleName: String) -> Bool {
51
- #if canImport(EOCore)
52
- return EOApplicationHelper().getBOOLconfigItem(forKey: key, withDefault: def, forModuleName: moduleName)
53
- #else
28
+ static func bool(forKey key: String, default def: Bool) -> Bool {
54
29
  let raw = ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key)
55
30
  if let n = raw as? NSNumber { return n.boolValue }
56
31
  if let s = raw as? String { return (s as NSString).boolValue }
57
32
  return def
58
- #endif
59
33
  }
60
34
 
61
- static func string(forKey key: String, default def: String, moduleName: String) -> String? {
62
- #if canImport(EOCore)
63
- return EOApplicationHelper().getStringItem(forKey: key, withDefault: def, forModuleName: moduleName)
64
- #else
35
+ static func string(forKey key: String, default def: String) -> String? {
65
36
  return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? String) ?? def
66
- #endif
67
37
  }
68
38
 
69
- static func number(forKey key: String, default def: Double, moduleName: String) -> Double {
70
- #if canImport(EOCore)
71
- return (EOApplicationHelper().getNumberItem(forKey: key, withDefault: NSNumber(value: def), forModuleName: moduleName) as? NSNumber)?.doubleValue ?? def
72
- #else
39
+ static func number(forKey key: String, default def: Double) -> Double {
73
40
  return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? NSNumber)?.doubleValue ?? def
74
- #endif
75
41
  }
76
42
  }
77
43
 
@@ -151,17 +117,15 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
151
117
  if let jsonData = jsonData,
152
118
  let connectData = jsonData["Connect"] as? [String: Any] {
153
119
  for (key, value) in connectData {
154
- if tealeafKeys.contains(key) {
155
- ConnectConfigStore.set(key, value: value, forModule: kTLFCoreModule)
156
- } else if eocoreKeys.contains(key) {
157
- ConnectConfigStore.set(key, value: value, forModule: kEOCoreModule)
120
+ if tealeafKeys.contains(key) || eocoreKeys.contains(key) {
121
+ ConnectConfigStore.set(key, value: value)
158
122
  } else if key == "layoutConfig",
159
123
  let layoutConfig = value as? [String: Any] {
160
124
  if let autoLayout = layoutConfig["AutoLayout"] {
161
- ConnectConfigStore.set("AutoLayout", value: autoLayout, forModule: kTLFCoreModule)
125
+ ConnectConfigStore.set("AutoLayout", value: autoLayout)
162
126
  }
163
127
  if let appendMapIds = layoutConfig["AppendMapIds"] {
164
- ConnectConfigStore.set("AppendMapIds", value: appendMapIds, forModule: kTLFCoreModule)
128
+ ConnectConfigStore.set("AppendMapIds", value: appendMapIds)
165
129
  }
166
130
  }
167
131
  }
@@ -175,7 +139,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
175
139
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
176
140
  /// - Returns: Whether it was able to set the value as Boolean value.
177
141
  func setBooleanConfigItemForKey(key: String, value: Bool, moduleName: String) throws -> Bool {
178
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
142
+ return ConnectConfigStore.set(key, value: value)
179
143
  }
180
144
 
181
145
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -185,7 +149,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
185
149
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
186
150
  /// - Returns: Whether it was able to set the value as Boolean value.
187
151
  func setStringItemForKey(key: String, value: String, moduleName: String) throws -> Bool {
188
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
152
+ return ConnectConfigStore.set(key, value: value)
189
153
  }
190
154
 
191
155
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NSNumber value.
@@ -195,7 +159,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
195
159
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
196
160
  /// - Returns: Whether it was able to set the value as Boolean value.
197
161
  func setNumberItemForKey(key: String, value: Double, moduleName: String) throws -> Bool {
198
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
162
+ return ConnectConfigStore.set(key, value: value)
199
163
  }
200
164
 
201
165
 
@@ -206,7 +170,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
206
170
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
207
171
  /// - Returns: Whether it was able to set the value.
208
172
  func setConfigItemForKey(key: String, value: Variant_Bool_String_Double, moduleName: String) throws -> Bool {
209
- return ConnectConfigStore.set(key, value: convertVariantToAny(value), forModule: moduleName)
173
+ return ConnectConfigStore.set(key, value: convertVariantToAny(value))
210
174
  }
211
175
 
212
176
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a BOOL value.
@@ -216,7 +180,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
216
180
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
217
181
  /// - Returns: The value of the configuration item key as a BOOL value.
218
182
  func getBooleanConfigItemForKey(theDefault: Bool, key: String, moduleName: String) throws -> Bool {
219
- return ConnectConfigStore.bool(forKey: key, default: theDefault, moduleName: moduleName)
183
+ return ConnectConfigStore.bool(forKey: key, default: theDefault)
220
184
  }
221
185
 
222
186
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -226,7 +190,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
226
190
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
227
191
  /// - Returns: The value of the configuration item key as a NString value.
228
192
  func getStringItemForKey(theDefault: String, key: String, moduleName: String) throws -> Variant_NullType_String? {
229
- let result = ConnectConfigStore.string(forKey: key, default: theDefault, moduleName: moduleName)
193
+ let result = ConnectConfigStore.string(forKey: key, default: theDefault)
230
194
  return result.map { .second($0) }
231
195
  }
232
196
 
@@ -237,7 +201,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
237
201
  /// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
238
202
  /// - Returns: The value of the configuration item key as a NSNumber value.
239
203
  func getNumberItemForKey(theDefault: Double, key: String, moduleName: String) throws -> Double {
240
- return ConnectConfigStore.number(forKey: key, default: theDefault, moduleName: moduleName)
204
+ return ConnectConfigStore.number(forKey: key, default: theDefault)
241
205
  }
242
206
 
243
207
  /// Log custom event.
@@ -25,10 +25,19 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
25
25
  const Connect = ({
26
26
  children,
27
27
  captureKeyboardEvents,
28
- captureDialogEvents = false
28
+ captureDialogEvents = false,
29
+ navigationRef
29
30
  }) => {
30
31
  const child = children;
31
- const navigation = child.props?.ref ?? child.ref;
32
+ const childProvidedRef = child?.props?.ref ?? child?.ref;
33
+ const internalRef = (0, _react.useRef)(null);
34
+
35
+ // Resolution order (explicit → legacy child ref → auto-injected fallback).
36
+ // The chosen ref flows through the same mount-effect / touch / layout
37
+ // guards, so any path that fails to resolve a usable navigation container
38
+ // simply disables tracking rather than breaking host-app gestures.
39
+ const navigation = navigationRef ?? childProvidedRef ?? internalRef;
40
+ const shouldInjectRef = !navigationRef && !childProvidedRef && /*#__PURE__*/_react.default.isValidElement(child);
32
41
  const currentRoute = (0, _react.useRef)(undefined);
33
42
  const initial = (0, _react.useRef)(false);
34
43
  (0, _react.useEffect)(() => {
@@ -38,8 +47,8 @@ const Connect = ({
38
47
  _TLTRN.default.interceptDialogEvents(captureDialogEvents);
39
48
  }, [captureDialogEvents]);
40
49
  (0, _react.useEffect)(() => {
41
- if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
42
- console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
50
+ if (!navigation || !navigation.current || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
51
+ console.warn("Connect: navigation tracking disabled no usable NavigationContainer ref resolved. " + "Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer.");
43
52
  return;
44
53
  }
45
54
 
@@ -61,24 +70,27 @@ const Connect = ({
61
70
  };
62
71
  }, [navigation]);
63
72
  const onStartShouldSetResponderCapture = (0, _react.useCallback)(event => {
64
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
65
- if (currentRoute && currentRoute.current) {
66
- _TLTRN.default.logScreenViewPageName(currentRoute.current);
73
+ if (navigation?.current?.getCurrentRoute) {
74
+ currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
75
+ if (currentRoute.current) {
76
+ _TLTRN.default.logScreenViewPageName(currentRoute.current);
77
+ }
67
78
  }
68
79
  _TLTRN.default.logClickEvent(event);
69
- return false; // Must be false; true means this component becomes the touch responder and events don't bubble
70
- }, []);
71
- const onLayout = (0, _react.useCallback)(event => {
80
+ return false; // Must remain false so events bubble to the host app's handlers
81
+ }, [navigation]);
82
+ const onLayout = (0, _react.useCallback)(_event => {
72
83
  if (initial.current) {
73
84
  return false;
74
85
  }
75
86
  initial.current = true;
76
- console.log("event - ", event.nativeEvent);
77
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
78
- if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
79
- _TLTRN.default.logScreenViewPageName(currentRoute.current);
80
- } else if (_reactNative.Platform.OS === "android") {
81
- _TLTRN.default.logScreenLayout(currentRoute.current);
87
+ if (navigation?.current?.getCurrentRoute) {
88
+ currentRoute.current = navigation.current.getCurrentRoute()?.name;
89
+ if (_reactNative.Platform.OS === "ios" && currentRoute.current) {
90
+ _TLTRN.default.logScreenViewPageName(currentRoute.current);
91
+ } else if (_reactNative.Platform.OS === "android") {
92
+ _TLTRN.default.logScreenLayout(currentRoute.current);
93
+ }
82
94
  }
83
95
  return true;
84
96
  }, [navigation]);
@@ -86,11 +98,13 @@ const Connect = ({
86
98
  style: styles.connect_main,
87
99
  onLayout: onLayout,
88
100
  onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
89
- children: children
101
+ children: shouldInjectRef ? /*#__PURE__*/_react.default.cloneElement(child, {
102
+ ref: internalRef
103
+ }) : children
90
104
  });
91
105
  };
92
106
  function extractName(navigation) {
93
- const routeParams = navigation.current.getCurrentRoute()?.params;
107
+ const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
94
108
  if (routeParams) {
95
109
  const {
96
110
  name
@@ -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","children","captureKeyboardEvents","captureDialogEvents","child","navigation","props","ref","currentRoute","useRef","undefined","initial","useEffect","TLTRN","interceptKeyboardEvents","interceptDialogEvents","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,6B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MAAM,CAACC,YAAa;IAC3BN,QAAQ,EAAEA,QAAS;IACnBJ,gCAAgC,EAAEA,gCAAiC;IAAA5B,QAAA,EAElEA;EAAQ,CACP,CAAC;AAEf,CAAC;AAED,SAASqB,WAAWA,CAACjB,UAAe,EAAU;EAC1C,MAAMmC,WAAW,GAAGnC,UAAU,CAACW,OAAO,CAACE,eAAe,CAAC,CAAC,EAAEuB,MAAM;EAChE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEjB;IAAK,CAAC,GAAGiB,WAAW;IAC5B,OAAOjB,IAAI,GAAGA,IAAI,GAAGlB,UAAU,CAACW,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEciB,OAAO;AAEtB,MAAMsC,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC7BN,YAAY,EAAE;IACVO,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
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","captureDialogEvents","navigationRef","child","childProvidedRef","props","ref","internalRef","useRef","navigation","shouldInjectRef","React","isValidElement","currentRoute","undefined","initial","useEffect","TLTRN","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","Platform","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","useCallback","event","logClickEvent","onLayout","_event","jsx","View","style","styles","connect_main","cloneElement","routeParams","params","_default","exports","StyleSheet","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAA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M4C,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC7BP,YAAY,EAAE;IACVQ,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -17,10 +17,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  const Connect = ({
18
18
  children,
19
19
  captureKeyboardEvents,
20
- captureDialogEvents = false
20
+ captureDialogEvents = false,
21
+ navigationRef
21
22
  }) => {
22
23
  const child = children;
23
- const navigation = child.props?.ref ?? child.ref;
24
+ const childProvidedRef = child?.props?.ref ?? child?.ref;
25
+ const internalRef = useRef(null);
26
+
27
+ // Resolution order (explicit → legacy child ref → auto-injected fallback).
28
+ // The chosen ref flows through the same mount-effect / touch / layout
29
+ // guards, so any path that fails to resolve a usable navigation container
30
+ // simply disables tracking rather than breaking host-app gestures.
31
+ const navigation = navigationRef ?? childProvidedRef ?? internalRef;
32
+ const shouldInjectRef = !navigationRef && !childProvidedRef && /*#__PURE__*/React.isValidElement(child);
24
33
  const currentRoute = useRef(undefined);
25
34
  const initial = useRef(false);
26
35
  useEffect(() => {
@@ -30,8 +39,8 @@ const Connect = ({
30
39
  TLTRN.interceptDialogEvents(captureDialogEvents);
31
40
  }, [captureDialogEvents]);
32
41
  useEffect(() => {
33
- if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
34
- console.warn("Connect: The Connect component's first child must be a NavigationContainer with a ref.");
42
+ if (!navigation || !navigation.current || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
43
+ console.warn("Connect: navigation tracking disabled no usable NavigationContainer ref resolved. " + "Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer.");
35
44
  return;
36
45
  }
37
46
 
@@ -53,24 +62,27 @@ const Connect = ({
53
62
  };
54
63
  }, [navigation]);
55
64
  const onStartShouldSetResponderCapture = useCallback(event => {
56
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
57
- if (currentRoute && currentRoute.current) {
58
- TLTRN.logScreenViewPageName(currentRoute.current);
65
+ if (navigation?.current?.getCurrentRoute) {
66
+ currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
67
+ if (currentRoute.current) {
68
+ TLTRN.logScreenViewPageName(currentRoute.current);
69
+ }
59
70
  }
60
71
  TLTRN.logClickEvent(event);
61
- return false; // Must be false; true means this component becomes the touch responder and events don't bubble
62
- }, []);
63
- const onLayout = useCallback(event => {
72
+ return false; // Must remain false so events bubble to the host app's handlers
73
+ }, [navigation]);
74
+ const onLayout = useCallback(_event => {
64
75
  if (initial.current) {
65
76
  return false;
66
77
  }
67
78
  initial.current = true;
68
- console.log("event - ", event.nativeEvent);
69
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
70
- if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
71
- TLTRN.logScreenViewPageName(currentRoute.current);
72
- } else if (Platform.OS === "android") {
73
- TLTRN.logScreenLayout(currentRoute.current);
79
+ if (navigation?.current?.getCurrentRoute) {
80
+ currentRoute.current = navigation.current.getCurrentRoute()?.name;
81
+ if (Platform.OS === "ios" && currentRoute.current) {
82
+ TLTRN.logScreenViewPageName(currentRoute.current);
83
+ } else if (Platform.OS === "android") {
84
+ TLTRN.logScreenLayout(currentRoute.current);
85
+ }
74
86
  }
75
87
  return true;
76
88
  }, [navigation]);
@@ -78,11 +90,13 @@ const Connect = ({
78
90
  style: styles.connect_main,
79
91
  onLayout: onLayout,
80
92
  onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
81
- children: children
93
+ children: shouldInjectRef ? /*#__PURE__*/React.cloneElement(child, {
94
+ ref: internalRef
95
+ }) : children
82
96
  });
83
97
  };
84
98
  function extractName(navigation) {
85
- const routeParams = navigation.current.getCurrentRoute()?.params;
99
+ const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
86
100
  if (routeParams) {
87
101
  const {
88
102
  name
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","TLTRN","jsx","_jsx","Connect","children","captureKeyboardEvents","captureDialogEvents","child","navigation","props","ref","currentRoute","undefined","initial","interceptKeyboardEvents","interceptDialogEvents","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,IAAAC,IAAA;AAQ7B,MAAMC,OAA+B,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,qBAAqB;EAAEC,mBAAmB,GAAG;AAAM,CAAC,KAAK;EAC1G,MAAMC,KAAK,GAAGH,QAAe;EAC7B,MAAMI,UAAU,GAAGD,KAAK,CAACE,KAAK,EAAEC,GAAG,IAAIH,KAAK,CAACG,GAAG;EAChD,MAAMC,YAAY,GAAGf,MAAM,CAAqBgB,SAAS,CAAC;EAC1D,MAAMC,OAAO,GAAGjB,MAAM,CAAU,KAAK,CAAC;EAEtCD,SAAS,CAAC,MAAM;IACZK,KAAK,CAACc,uBAAuB,CAACT,qBAAqB,CAAC;EACxD,CAAC,EAAE,CAACA,qBAAqB,CAAC,CAAC;EAE3BV,SAAS,CAAC,MAAM;IACZK,KAAK,CAACe,qBAAqB,CAACT,mBAAmB,CAAC;EACpD,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzBX,SAAS,CAAC,MAAM;IACZ,IACI,CAACa,UAAU,IACX,OAAOA,UAAU,CAACQ,OAAO,CAACC,WAAW,KAAK,UAAU,IACpD,OAAOT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EtB,MAAM+B,MAAM,GAAGpC,UAAU,CAACwC,MAAM,CAAC;EAC7BH,YAAY,EAAE;IACVI,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","TLTRN","jsx","_jsx","Connect","children","captureKeyboardEvents","captureDialogEvents","navigationRef","child","childProvidedRef","props","ref","internalRef","navigation","shouldInjectRef","isValidElement","currentRoute","undefined","initial","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","event","logClickEvent","onLayout","_event","style","styles","connect_main","cloneElement","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,QAAQ,OAAO;AAC7D,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACF;AACvD,OAAOC,KAAK,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAoB7B,MAAMC,OAA+B,GAAGA,CAAC;EACrCC,QAAQ;EACRC,qBAAqB;EACrBC,mBAAmB,GAAG,KAAK;EAC3BC;AACJ,CAAC,KAAK;EACF,MAAMC,KAAK,GAAGJ,QAAe;EAC7B,MAAMK,gBAAgB,GAAGD,KAAK,EAAEE,KAAK,EAAEC,GAAG,IAAIH,KAAK,EAAEG,GAAG;EACxD,MAAMC,WAAW,GAAGhB,MAAM,CAAM,IAAI,CAAC;;EAErC;EACA;EACA;EACA;EACA,MAAMiB,UAAU,GAAGN,aAAa,IAAIE,gBAAgB,IAAIG,WAAW;EACnE,MAAME,eAAe,GACjB,CAACP,aAAa,IAAI,CAACE,gBAAgB,iBAAIhB,KAAK,CAACsB,cAAc,CAACP,KAAK,CAAC;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AC;EAEhB,oBACIX,IAAA,CAACL,IAAI;IACDyC,KAAK,EAAEC,MAAM,CAACC,YAAa;IAC3BJ,QAAQ,EAAEA,QAAS;IACnBH,gCAAgC,EAAEA,gCAAiC;IAAA7B,QAAA,EAElEU,eAAe,gBACVrB,KAAK,CAACgD,YAAY,CAACjC,KAAK,EAA6B;MAAEG,GAAG,EAAEC;IAAY,CAAC,CAAC,GAC1ER;EAAQ,CACZ,CAAC;AAEf,CAAC;AAED,SAASuB,WAAWA,CAACd,UAAe,EAAU;EAC1C,MAAM6B,WAAW,GAAG7B,UAAU,EAAEQ,OAAO,EAAEE,eAAe,GAAG,CAAC,EAAEoB,MAAM;EACpE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEd;IAAK,CAAC,GAAGc,WAAW;IAC5B,OAAOd,IAAI,GAAGA,IAAI,GAAGf,UAAU,CAACQ,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAEA,eAAezB,OAAO;AAEtB,MAAMoC,MAAM,GAAGzC,UAAU,CAAC8C,MAAM,CAAC;EAC7BJ,YAAY,EAAE;IACVK,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -12,6 +12,18 @@ interface ConnectProps {
12
12
  children: React.ReactNode;
13
13
  captureKeyboardEvents: boolean;
14
14
  captureDialogEvents?: boolean;
15
+ /**
16
+ * Preferred: an explicit NavigationContainer ref obtained from
17
+ * `useNavigationContainerRef()`. Using this prop decouples <Connect> from
18
+ * any assumption about the children structure and is the recommended
19
+ * integration path.
20
+ *
21
+ * If omitted, <Connect> falls back to (a) inspecting the direct child's
22
+ * own ref, then (b) auto-injecting an internal ref via cloneElement.
23
+ * Every path degrades gracefully — if no usable ref is resolved,
24
+ * screen-name tracking is disabled but touches still reach host components.
25
+ */
26
+ navigationRef?: React.RefObject<any>;
15
27
  }
16
28
  declare const Connect: React.FC<ConnectProps>;
17
29
  export default Connect;
@@ -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;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgFnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;CACxC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAsGnC,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.20",
195
+ "version": "18.0.21",
196
196
  "workspaces": [
197
197
  "example"
198
198
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Connect": {
3
- "AndroidVersion": "11.0.8-beta",
3
+ "AndroidVersion": "11.0.9-beta",
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",
@@ -7,8 +7,8 @@
7
7
  * Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
8
8
  * prohibited.
9
9
  ********************************************************************************************/
10
- import React, { useCallback, useEffect, useRef, forwardRef } from "react";
11
- import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
10
+ import React, { useCallback, useEffect, useRef } from "react";
11
+ import { View, StyleSheet, Platform } from "react-native";
12
12
  import type { LayoutChangeEvent } from "react-native"; // Use type-only import for LayoutChangeEvent
13
13
  import TLTRN from '../TLTRN';
14
14
 
@@ -16,11 +16,38 @@ interface ConnectProps {
16
16
  children: React.ReactNode;
17
17
  captureKeyboardEvents: boolean;
18
18
  captureDialogEvents?: boolean; // New prop for dialog event capture
19
+ /**
20
+ * Preferred: an explicit NavigationContainer ref obtained from
21
+ * `useNavigationContainerRef()`. Using this prop decouples <Connect> from
22
+ * any assumption about the children structure and is the recommended
23
+ * integration path.
24
+ *
25
+ * If omitted, <Connect> falls back to (a) inspecting the direct child's
26
+ * own ref, then (b) auto-injecting an internal ref via cloneElement.
27
+ * Every path degrades gracefully — if no usable ref is resolved,
28
+ * screen-name tracking is disabled but touches still reach host components.
29
+ */
30
+ navigationRef?: React.RefObject<any>;
19
31
  }
20
32
 
21
- const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, captureDialogEvents = false }) => {
33
+ const Connect: React.FC<ConnectProps> = ({
34
+ children,
35
+ captureKeyboardEvents,
36
+ captureDialogEvents = false,
37
+ navigationRef,
38
+ }) => {
22
39
  const child = children as any;
23
- const navigation = child.props?.ref ?? child.ref;
40
+ const childProvidedRef = child?.props?.ref ?? child?.ref;
41
+ const internalRef = useRef<any>(null);
42
+
43
+ // Resolution order (explicit → legacy child ref → auto-injected fallback).
44
+ // The chosen ref flows through the same mount-effect / touch / layout
45
+ // guards, so any path that fails to resolve a usable navigation container
46
+ // simply disables tracking rather than breaking host-app gestures.
47
+ const navigation = navigationRef ?? childProvidedRef ?? internalRef;
48
+ const shouldInjectRef =
49
+ !navigationRef && !childProvidedRef && React.isValidElement(child);
50
+
24
51
  const currentRoute = useRef<string | undefined>(undefined);
25
52
  const initial = useRef<boolean>(false);
26
53
 
@@ -35,11 +62,13 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
35
62
  useEffect(() => {
36
63
  if (
37
64
  !navigation ||
65
+ !navigation.current ||
38
66
  typeof navigation.current.addListener !== "function" ||
39
67
  typeof navigation.current.getCurrentRoute !== "function"
40
68
  ) {
41
69
  console.warn(
42
- "Connect: The Connect component's first child must be a NavigationContainer with a ref."
70
+ "Connect: navigation tracking disabled no usable NavigationContainer ref resolved. " +
71
+ "Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer."
43
72
  );
44
73
  return;
45
74
  }
@@ -64,29 +93,32 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
64
93
  }, [navigation]);
65
94
 
66
95
  const onStartShouldSetResponderCapture = useCallback((event: any) => {
67
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
68
- if (currentRoute && currentRoute.current) {
69
- TLTRN.logScreenViewPageName(currentRoute.current);
96
+ if (navigation?.current?.getCurrentRoute) {
97
+ currentRoute.current =
98
+ extractName(navigation) || navigation.current.getCurrentRoute()?.name;
99
+ if (currentRoute.current) {
100
+ TLTRN.logScreenViewPageName(currentRoute.current);
101
+ }
70
102
  }
71
103
  TLTRN.logClickEvent(event);
72
- return false; // Must be false; true means this component becomes the touch responder and events don't bubble
73
- }, []);
104
+ return false; // Must remain false so events bubble to the host app's handlers
105
+ }, [navigation]);
74
106
 
75
- const onLayout = useCallback((event: LayoutChangeEvent) => {
107
+ const onLayout = useCallback((_event: LayoutChangeEvent) => {
76
108
  if (initial.current) {
77
109
  return false;
78
110
  }
79
111
  initial.current = true;
80
112
 
81
- console.log("event - ", event.nativeEvent);
82
-
83
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
84
- if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
85
- TLTRN.logScreenViewPageName(currentRoute.current);
86
- } else if (Platform.OS === "android") {
87
- TLTRN.logScreenLayout(currentRoute.current);
113
+ if (navigation?.current?.getCurrentRoute) {
114
+ currentRoute.current = navigation.current.getCurrentRoute()?.name;
115
+ if (Platform.OS === "ios" && currentRoute.current) {
116
+ TLTRN.logScreenViewPageName(currentRoute.current);
117
+ } else if (Platform.OS === "android") {
118
+ TLTRN.logScreenLayout(currentRoute.current);
119
+ }
88
120
  }
89
- return true
121
+ return true;
90
122
  }, [navigation]);
91
123
 
92
124
  return (
@@ -95,13 +127,15 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
95
127
  onLayout={onLayout}
96
128
  onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
97
129
  >
98
- {children}
130
+ {shouldInjectRef
131
+ ? React.cloneElement(child as React.ReactElement<any>, { ref: internalRef })
132
+ : children}
99
133
  </View>
100
134
  );
101
135
  };
102
136
 
103
137
  function extractName(navigation: any): string {
104
- const routeParams = navigation.current.getCurrentRoute()?.params;
138
+ const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
105
139
  if (routeParams) {
106
140
  const { name } = routeParams;
107
141
  return name ? name : navigation.current?.getCurrentRoute()?.name || "";